Skip to content

Commit 58b47f3

Browse files
committed
chore(examples): use proper methods
1 parent 004450e commit 58b47f3

File tree

2 files changed

+25
-11
lines changed

2 files changed

+25
-11
lines changed

examples/iut/signatures/dump.mts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { CAS } from "unilim/cas";
2+
import { Signatures } from "unilim/iut/signatures";
3+
4+
const cas = await CAS.restore(
5+
Bun.env.USERNAME!, Bun.env.PASSWORD!,
6+
Bun.env.CONNECTION!, Bun.env.KEY!
7+
);
8+
9+
let signatures = await Signatures.fromCAS(cas);
10+
11+
// You can now build as much instance of `Signatures` as you want,
12+
// using the session cookie! You don't need the CAS anymore!
13+
signatures = new Signatures(signatures.session);
14+
15+
// const html = await signatures.getHtml(); < Retrieve HTML from Signatures.
16+
// const card = Signatures.parse(html); < Parse card from HTML.
17+
//
18+
// The following method is a contraction of these two methods.
19+
const card = await signatures.dump();
20+
21+
console.log(`Welcome ${card.fullName}, you're in ${card.promotion}!`);
22+
23+
for (const semester of card.semesters) {
24+
console.log(">", semester.name, "have", semester.units.length, "units");
25+
}

examples/iut/signatures/extract.mts

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)