Skip to content

Commit 11021c1

Browse files
committed
fix: linter and breaking changes
1 parent 0612617 commit 11021c1

39 files changed

+370
-360
lines changed

examples/_credentials.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { config } from "dotenv";
21
import { join } from "node:path";
2+
import { config } from "dotenv";
33
// Load the `.env` file configuration.
44
config({ path: join(__dirname, ".env") });
55

examples/balance.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as izly from "../src";
22
import { read } from "./_persisted-session";
33

4-
void async function main () {
4+
void (async function main() {
55
const identification = await read();
66

77
const balance = await izly.balance(identification);
@@ -11,4 +11,4 @@ void async function main () {
1111
console.log("Your balance is currently at", balance.value, configuration.currency);
1212
console.log("Your cash balance is currently at", balance.cashValue, configuration.currency);
1313
console.log(`Last updated the ${balance.lastUpdate.toLocaleString("fr-FR")}`);
14-
}();
14+
}());

examples/contact.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import * as izly from "../src";
22
import { read } from "./_persisted-session";
33

4-
void async function main () {
4+
void (async function main() {
55
const identification = await read();
66
const contact = await izly.contact(identification);
77

88
console.dir(contact, { depth: Infinity });
9-
}();
9+
}());

examples/crous-contact.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import * as izly from "../src";
22
import { read } from "./_persisted-session";
33

4-
void async function main () {
4+
void (async function main() {
55
const identification = await read();
66

77
const contacts = await izly.crousContacts(identification);
88
console.dir(contacts, { depth: Infinity });
9-
}();
9+
}());

examples/generate-pay-qr-code.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1+
import { toString as qrcode } from "qrcode";
12
import * as izly from "../src";
23
import { persist, read } from "./_persisted-session";
3-
import { toString as qrcode } from "qrcode";
44

5-
void async function main () {
5+
void (async function main() {
66
const identification = await read();
77
const data = izly.qrPay(identification);
88

@@ -12,4 +12,4 @@ void async function main () {
1212
});
1313

1414
await persist(identification);
15-
}();
15+
}());

examples/limits.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import * as izly from "../src";
22
import { read } from "./_persisted-session";
33

4-
void async function main () {
4+
void (async function main() {
55
const identification = await read();
66

77
const limits = await izly.limits(identification);
88
console.dir(limits, { depth: Infinity });
9-
}();
9+
}());

examples/mobile.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import * as izly from "../src";
22
import { credentials } from "./_credentials";
33
import { persist } from "./_persisted-session";
44

5-
void async function main () {
5+
void (async function main() {
66
const { uid } = await izly.login(credentials.identifier, credentials.secret);
77

88
// NOTE: `prompt` is only available on Bun
@@ -11,7 +11,7 @@ void async function main () {
1111
if (!url) throw new Error("No URL provided");
1212

1313
const activationURL = await izly.extractActivationURL(url);
14-
const { identification, profile, configuration, balance } = await izly.tokenize(activationURL);
14+
const { balance, configuration, identification, profile } = await izly.tokenize(activationURL);
1515

1616
// Let's save the auth object for usage in other files without
1717
// re-doing the whole authentication...
@@ -36,4 +36,4 @@ void async function main () {
3636
console.warn("Note that there's no way to retrieve again 'identification' so make sure to store it if you need to do other requests.");
3737

3838
console.log("\nAnyway, since you're in the examples, I've exported the object in a JSON file so you can run other examples without re-doing the whole authentication process !");
39-
}();
39+
}());

examples/operations.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as izly from "../src";
22
import { read } from "./_persisted-session";
33

4-
void async function main () {
4+
void (async function main() {
55
const identification = await read();
66

77
const payments = await izly.operations(identification, izly.TransactionGroup.Payments, 5);
@@ -10,7 +10,7 @@ void async function main () {
1010
console.info("--- Payments");
1111
for (const payment of payments) {
1212
const priceAsString = `${payment.amount.toPrecision(3)} EUR`;
13-
console.info("Paid", priceAsString, "the", payment.date.toLocaleString("fr-FR") );
13+
console.info("Paid", priceAsString, "the", payment.date.toLocaleString("fr-FR"));
1414
console.info("=> (type):", izly.OperationType[payment.type], `(${payment.type})`);
1515
console.info("=> (status):", izly.TransactionGroupStatus[payment.status], `(${payment.status})`);
1616
}
@@ -22,4 +22,4 @@ void async function main () {
2222
console.info("=> (type):", izly.OperationType[operation.type], `(${operation.type})`);
2323
console.info("=> (status):", izly.TransactionGroupStatus[operation.status], `(${operation.status})`);
2424
}
25-
}();
25+
}());

examples/refresh.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import * as izly from "../src";
22
import { credentials } from "./_credentials";
3-
import { read, persist } from "./_persisted-session";
3+
import { persist, read } from "./_persisted-session";
44

5-
void async function main () {
5+
void (async function main() {
66
const identification = await read();
77

88
await izly.refresh(identification, credentials.secret);
99
// identification mutated, we need to resave it.
1010
await persist(identification);
1111

1212
console.log("Session refreshed !");
13-
}();
13+
}());

src/api/balance.ts

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,38 @@
1+
import type { Error as ServerError } from "~/definitions/error";
2+
import type { UP } from "~/definitions/up";
13
import { defaultFetcher, type Fetcher, type Request } from "@literate.ink/utilities";
24
import { CLIENT_TYPE, createRouteREST, SERVICE_VERSION } from "~/core/constants";
35
import { decodeBalance } from "~/decoders/balance";
4-
import { ReauthenticateError, type Balance, type Identification } from "~/models";
5-
import type { Error as ServerError } from "~/definitions/error";
6-
import { UP } from "~/definitions/up";
6+
import { type Balance, type Identification, ReauthenticateError } from "~/models";
77

88
export const balance = async (identification: Identification, fetcher: Fetcher = defaultFetcher): Promise<Balance> => {
99
const request: Request = {
10-
url: createRouteREST("IsSessionValid"),
11-
method: "POST",
10+
content: JSON.stringify({
11+
sessionId: identification.sessionID
12+
}),
1213
headers: {
13-
version: "1.0",
14-
channel: "AIZ",
15-
format: "T",
16-
model: "A",
17-
clientVersion: SERVICE_VERSION,
18-
smoneyClientType: CLIENT_TYPE,
19-
language: "fr",
20-
userId: identification.identifier,
21-
sessionId: identification.sessionID,
14+
"Authorization": `Bearer ${identification.accessToken}`,
15+
"channel": "AIZ",
16+
"clientVersion": SERVICE_VERSION,
2217
"Content-Type": "application/json",
23-
"Authorization": `Bearer ${identification.accessToken}`
18+
"format": "T",
19+
"language": "fr",
20+
"model": "A",
21+
"sessionId": identification.sessionID,
22+
"smoneyClientType": CLIENT_TYPE,
23+
"userId": identification.identifier,
24+
"version": "1.0"
2425
},
25-
content: JSON.stringify({
26-
sessionId: identification.sessionID
27-
})
26+
method: "POST",
27+
url: createRouteREST("IsSessionValid")
2828
};
2929

3030
const response = await fetcher(request);
31-
const json = JSON.parse(response.content) as {
31+
const json = JSON.parse(response.content) as ServerError | {
3232
IsSessionValidResult: {
33-
UP: UP
34-
}
35-
} | ServerError;
33+
UP: UP;
34+
};
35+
};
3636

3737
if ("ErrorMessage" in json) {
3838
if (json.Code === 140 || json.Code === 570)

0 commit comments

Comments
 (0)