-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.ts
More file actions
33 lines (26 loc) · 827 Bytes
/
example.ts
File metadata and controls
33 lines (26 loc) · 827 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import { Magister6Client } from "./src/index.js";
async function main() {
const client = new Magister6Client({
tenant: "schoolnaam",
username: "gebruikersnaam",
password: "wachtwoord",
});
console.log("Authenticating...");
await client.ready();
console.log("Authentication complete");
const tokens = client.getTokens();
const personId = client.getPersonId();
console.log("\nTokens:", tokens);
console.log("\nPerson ID:", personId);
if (personId) {
console.log("\nFetching latest grades...");
const grades = await client.apiRequest(`/api/personen/${personId}/cijfers/laatste?top=25&skip=0`);
if (grades) {
console.log("\nLatest grades:", JSON.stringify(grades, null, 2));
}
}
}
main().catch((err) => {
console.error("Error:", err.message);
process.exit(1);
});