@n1xyz/nord-ts 0.1.3 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/gen/nord_pb.d.ts +399 -3
- package/dist/gen/nord_pb.js +119 -61
- package/dist/gen/openapi.d.ts +216 -3
- package/dist/nord/api/actions.d.ts +11 -0
- package/dist/nord/api/actions.js +18 -0
- package/dist/nord/client/Nord.d.ts +113 -8
- package/dist/nord/client/Nord.js +206 -8
- package/dist/nord/client/NordAdmin.d.ts +236 -0
- package/dist/nord/client/NordAdmin.js +337 -0
- package/dist/nord/client/NordClient.d.ts +33 -0
- package/dist/nord/client/NordClient.js +45 -0
- package/dist/nord/client/NordUser.d.ts +6 -50
- package/dist/nord/client/NordUser.js +162 -133
- package/dist/nord/index.d.ts +4 -0
- package/dist/nord/index.js +5 -1
- package/dist/types.d.ts +13 -5
- package/dist/utils.d.ts +1 -0
- package/dist/utils.js +5 -0
- package/package.json +2 -2
- package/src/gen/nord_pb.ts +499 -60
- package/src/gen/openapi.ts +216 -3
- package/src/nord/api/actions.ts +28 -4
- package/src/nord/client/Nord.ts +258 -15
- package/src/nord/client/NordAdmin.ts +441 -0
- package/src/nord/client/NordClient.ts +79 -0
- package/src/nord/client/NordUser.ts +176 -229
- package/src/nord/index.ts +11 -0
- package/src/types.ts +15 -5
- package/src/utils.ts +5 -0
- package/src/nord/api/triggers.ts +0 -57
package/src/nord/api/triggers.ts
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import createClient from "openapi-fetch";
|
|
2
|
-
|
|
3
|
-
import { paths, components } from "../../gen/openapi";
|
|
4
|
-
|
|
5
|
-
type AccountTriggerInfo = components["schemas"]["AccountTriggerInfo"];
|
|
6
|
-
type TriggerHistoryPage =
|
|
7
|
-
components["schemas"]["PageResult_for_uint64_and_HistoryTriggerInfo"];
|
|
8
|
-
type HistoryTriggerQuery = components["schemas"]["AccountTriggersQuery"];
|
|
9
|
-
|
|
10
|
-
export type { AccountTriggerInfo, TriggerHistoryPage, HistoryTriggerQuery };
|
|
11
|
-
|
|
12
|
-
export async function getAccountTriggers(
|
|
13
|
-
serverUrl: string,
|
|
14
|
-
accountId: number,
|
|
15
|
-
): Promise<AccountTriggerInfo[]> {
|
|
16
|
-
const client = createClient<paths>({ baseUrl: serverUrl });
|
|
17
|
-
const response = await client.GET("/account/{account_id}/triggers", {
|
|
18
|
-
params: {
|
|
19
|
-
path: { account_id: accountId },
|
|
20
|
-
},
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
if (response.data === undefined) {
|
|
24
|
-
throw new Error(
|
|
25
|
-
`Failed to fetch triggers for account ${accountId}: HTTP ${response.response.status}`,
|
|
26
|
-
);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
return response.data ?? [];
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export async function getAccountTriggerHistory(
|
|
33
|
-
serverUrl: string,
|
|
34
|
-
accountId: number,
|
|
35
|
-
options: HistoryTriggerQuery,
|
|
36
|
-
): Promise<TriggerHistoryPage> {
|
|
37
|
-
const client = createClient<paths>({ baseUrl: serverUrl });
|
|
38
|
-
const response = await client.GET("/account/{account_id}/triggers/history", {
|
|
39
|
-
params: {
|
|
40
|
-
path: { account_id: accountId },
|
|
41
|
-
query: {
|
|
42
|
-
since: options.since,
|
|
43
|
-
until: options.until,
|
|
44
|
-
pageSize: options.pageSize,
|
|
45
|
-
startInclusive: options.startInclusive,
|
|
46
|
-
},
|
|
47
|
-
},
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
if (!response.data) {
|
|
51
|
-
throw new Error(
|
|
52
|
-
`Failed to fetch trigger history for account ${accountId}: HTTP ${response.response.status}`,
|
|
53
|
-
);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
return response.data;
|
|
57
|
-
}
|