@allisall/sdk 0.0.0-stage → 0.2.0
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/LICENSE +202 -0
- package/NOTICE +2 -0
- package/README.md +227 -2
- package/dist/client.d.ts +121 -0
- package/dist/client.js +193 -0
- package/dist/decimal.d.ts +20 -0
- package/dist/decimal.js +23 -0
- package/dist/errors.d.ts +79 -0
- package/dist/errors.js +98 -0
- package/dist/generated/openapi.d.ts +7724 -0
- package/dist/generated/openapi.js +4 -0
- package/dist/generated/operations.d.ts +37 -0
- package/dist/generated/operations.js +976 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +5 -0
- package/dist/ingest.d.ts +28 -0
- package/dist/ingest.js +247 -0
- package/dist/money.d.ts +57 -0
- package/dist/money.js +284 -0
- package/dist/multipart.d.ts +27 -0
- package/dist/multipart.js +48 -0
- package/dist/options.d.ts +50 -0
- package/dist/options.js +73 -0
- package/dist/pagination.d.ts +55 -0
- package/dist/pagination.js +85 -0
- package/dist/request.d.ts +117 -0
- package/dist/request.js +363 -0
- package/dist/resources/agents.d.ts +51 -0
- package/dist/resources/agents.js +65 -0
- package/dist/resources/analytics.d.ts +42 -0
- package/dist/resources/analytics.js +68 -0
- package/dist/resources/api-keys.d.ts +54 -0
- package/dist/resources/api-keys.js +63 -0
- package/dist/resources/calculations.d.ts +78 -0
- package/dist/resources/calculations.js +111 -0
- package/dist/resources/clients.d.ts +65 -0
- package/dist/resources/clients.js +85 -0
- package/dist/resources/cost.d.ts +69 -0
- package/dist/resources/cost.js +89 -0
- package/dist/resources/dashboard.d.ts +24 -0
- package/dist/resources/dashboard.js +28 -0
- package/dist/resources/events.d.ts +47 -0
- package/dist/resources/events.js +69 -0
- package/dist/resources/health.d.ts +14 -0
- package/dist/resources/health.js +17 -0
- package/dist/resources/imports.d.ts +33 -0
- package/dist/resources/imports.js +37 -0
- package/dist/resources/outcome-types.d.ts +25 -0
- package/dist/resources/outcome-types.js +33 -0
- package/dist/resources/reports.d.ts +77 -0
- package/dist/resources/reports.js +103 -0
- package/dist/resources/value-models.d.ts +92 -0
- package/dist/resources/value-models.js +126 -0
- package/dist/retry.d.ts +18 -0
- package/dist/retry.js +105 -0
- package/dist/runtime.d.ts +19 -0
- package/dist/runtime.js +61 -0
- package/dist/share.d.ts +52 -0
- package/dist/share.js +60 -0
- package/dist/transport.d.ts +102 -0
- package/dist/transport.js +269 -0
- package/dist/types.d.ts +268 -0
- package/dist/types.js +89 -0
- package/dist/unicode.d.ts +2 -0
- package/dist/unicode.js +11 -0
- package/dist/uuid.d.ts +6 -0
- package/dist/uuid.js +20 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.js +2 -0
- package/package.json +40 -4
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
// The `apiKeys` operations: a workspace's API keys, managed with a
|
|
2
|
+
// session token.
|
|
3
|
+
import { call, callPage } from "../request.js";
|
|
4
|
+
/** The `apiKeys` operations. */
|
|
5
|
+
export class ApiKeys {
|
|
6
|
+
#config;
|
|
7
|
+
constructor(config) {
|
|
8
|
+
this.#config = config;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Creates an API key, and returns its complete token once. Store the
|
|
12
|
+
* token at once: no later call returns it, because the API keeps only a
|
|
13
|
+
* hash.
|
|
14
|
+
*
|
|
15
|
+
* Never retried, because a retried create would make a second key. On a
|
|
16
|
+
* `ConnectionError`, list the keys to learn whether it was created.
|
|
17
|
+
*
|
|
18
|
+
* Needs a session token: an API key cannot create a key. An API key is
|
|
19
|
+
* refused with `403` `session_required`, as an `ApiError`.
|
|
20
|
+
*
|
|
21
|
+
* Operation `createApiKey`.
|
|
22
|
+
*/
|
|
23
|
+
create(body, options) {
|
|
24
|
+
return call(this.#config, "createApiKey", { body, options });
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Lists API keys. Await the result for one page; iterate it with
|
|
28
|
+
* `for await` for every key of every page.
|
|
29
|
+
*
|
|
30
|
+
* Needs a session token. An API key is refused with `403`
|
|
31
|
+
* `session_required`, as an `ApiError`.
|
|
32
|
+
*
|
|
33
|
+
* Operation `listApiKeys`.
|
|
34
|
+
*/
|
|
35
|
+
list(query, options) {
|
|
36
|
+
return callPage(this.#config, "listApiKeys", { query, options });
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Reads an API key. Its token is never returned.
|
|
40
|
+
*
|
|
41
|
+
* Needs a session token. An API key is refused with `403`
|
|
42
|
+
* `session_required`, as an `ApiError`.
|
|
43
|
+
*
|
|
44
|
+
* Operation `getApiKey`.
|
|
45
|
+
*/
|
|
46
|
+
get(id, options) {
|
|
47
|
+
return call(this.#config, "getApiKey", { path: { id }, options });
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Revokes an API key. The next request bearing the key is refused with
|
|
51
|
+
* `401`.
|
|
52
|
+
*
|
|
53
|
+
* Needs a session token. An API key is refused with `403`
|
|
54
|
+
* `session_required`, as an `ApiError`. Never retried.
|
|
55
|
+
*
|
|
56
|
+
* Operation `revokeApiKey`.
|
|
57
|
+
*
|
|
58
|
+
* @param id - the key's `id`, not its token.
|
|
59
|
+
*/
|
|
60
|
+
revoke(id, options) {
|
|
61
|
+
return call(this.#config, "revokeApiKey", { path: { id }, options });
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import type { IdempotentRequestOptions, RequestOptions } from "../options.js";
|
|
2
|
+
import type { PagePromise } from "../pagination.js";
|
|
3
|
+
import type { TransportConfig } from "../transport.js";
|
|
4
|
+
import type { Calculation, CalculationCreate, CalculationList, CalculationSummary, ChecklistInput, ListClientCalculationsQuery } from "../types.js";
|
|
5
|
+
/** The `calculations` operations. */
|
|
6
|
+
export declare class Calculations {
|
|
7
|
+
#private;
|
|
8
|
+
constructor(config: TransportConfig);
|
|
9
|
+
/**
|
|
10
|
+
* Freezes a client's ROI for an ended period as a draft calculation. An
|
|
11
|
+
* API key with the `write` scope may create a draft; validating and
|
|
12
|
+
* publishing it need a session token.
|
|
13
|
+
*
|
|
14
|
+
* Every attempt of the call sends one `Idempotency-Key`, so a retry
|
|
15
|
+
* cannot create a second calculation.
|
|
16
|
+
*
|
|
17
|
+
* Needs the `write` scope. Operation `createCalculation`.
|
|
18
|
+
*
|
|
19
|
+
* @param clientId - the client's id.
|
|
20
|
+
*/
|
|
21
|
+
createForClient(clientId: string, body: CalculationCreate, options?: IdempotentRequestOptions): Promise<Calculation>;
|
|
22
|
+
/**
|
|
23
|
+
* Lists a client's calculations. Await the result for one page; iterate
|
|
24
|
+
* it with `for await` for every calculation of every page.
|
|
25
|
+
*
|
|
26
|
+
* Needs the `read` scope. Operation `listClientCalculations`.
|
|
27
|
+
*
|
|
28
|
+
* @param clientId - the client's id.
|
|
29
|
+
*/
|
|
30
|
+
listForClient(clientId: string, query?: ListClientCalculationsQuery, options?: RequestOptions): PagePromise<CalculationSummary, CalculationList>;
|
|
31
|
+
/**
|
|
32
|
+
* Reads a calculation.
|
|
33
|
+
*
|
|
34
|
+
* Needs the `read` scope. Operation `getCalculation`.
|
|
35
|
+
*/
|
|
36
|
+
get(id: string, options?: RequestOptions): Promise<Calculation>;
|
|
37
|
+
/**
|
|
38
|
+
* Deletes a draft calculation.
|
|
39
|
+
*
|
|
40
|
+
* A retry after a lost response can answer `404` for a delete that
|
|
41
|
+
* succeeded.
|
|
42
|
+
*
|
|
43
|
+
* Needs the `write` scope. Operation `deleteCalculation`.
|
|
44
|
+
*/
|
|
45
|
+
delete(id: string, options?: RequestOptions): Promise<void>;
|
|
46
|
+
/**
|
|
47
|
+
* Validates a calculation: records the validation checklist, an
|
|
48
|
+
* attestation that the figures were reviewed, and moves a draft to
|
|
49
|
+
* `validated`.
|
|
50
|
+
*
|
|
51
|
+
* Needs a session token: validation is a human attestation. An API key
|
|
52
|
+
* is refused with `403` `session_required`, as an `ApiError`. Never
|
|
53
|
+
* retried.
|
|
54
|
+
*
|
|
55
|
+
* Operation `validateCalculation`.
|
|
56
|
+
*/
|
|
57
|
+
validate(id: string, body: ChecklistInput, options?: RequestOptions): Promise<Calculation>;
|
|
58
|
+
/**
|
|
59
|
+
* Publishes a calculation: moves a validated calculation to `published`.
|
|
60
|
+
* Publication is terminal.
|
|
61
|
+
*
|
|
62
|
+
* Needs a session token: publishing is a human trust step. An API key is
|
|
63
|
+
* refused with `403` `session_required`, as an `ApiError`. Never retried.
|
|
64
|
+
*
|
|
65
|
+
* Operation `publishCalculation`.
|
|
66
|
+
*/
|
|
67
|
+
publish(id: string, options?: RequestOptions): Promise<Calculation>;
|
|
68
|
+
/**
|
|
69
|
+
* Reopens a calculation: moves a validated calculation back to `draft`,
|
|
70
|
+
* clearing its attestation.
|
|
71
|
+
*
|
|
72
|
+
* Needs a session token: it undoes a human trust step. An API key is
|
|
73
|
+
* refused with `403` `session_required`, as an `ApiError`. Never retried.
|
|
74
|
+
*
|
|
75
|
+
* Operation `reopenCalculation`.
|
|
76
|
+
*/
|
|
77
|
+
reopen(id: string, options?: RequestOptions): Promise<Calculation>;
|
|
78
|
+
}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
// The `calculations` operations: a client's frozen ROI for a period, and
|
|
2
|
+
// the human steps that validate, publish and reopen it.
|
|
3
|
+
import { call, callPage } from "../request.js";
|
|
4
|
+
/** The `calculations` operations. */
|
|
5
|
+
export class Calculations {
|
|
6
|
+
#config;
|
|
7
|
+
constructor(config) {
|
|
8
|
+
this.#config = config;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Freezes a client's ROI for an ended period as a draft calculation. An
|
|
12
|
+
* API key with the `write` scope may create a draft; validating and
|
|
13
|
+
* publishing it need a session token.
|
|
14
|
+
*
|
|
15
|
+
* Every attempt of the call sends one `Idempotency-Key`, so a retry
|
|
16
|
+
* cannot create a second calculation.
|
|
17
|
+
*
|
|
18
|
+
* Needs the `write` scope. Operation `createCalculation`.
|
|
19
|
+
*
|
|
20
|
+
* @param clientId - the client's id.
|
|
21
|
+
*/
|
|
22
|
+
createForClient(clientId, body, options) {
|
|
23
|
+
return call(this.#config, "createCalculation", {
|
|
24
|
+
path: { id: clientId },
|
|
25
|
+
body,
|
|
26
|
+
options,
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Lists a client's calculations. Await the result for one page; iterate
|
|
31
|
+
* it with `for await` for every calculation of every page.
|
|
32
|
+
*
|
|
33
|
+
* Needs the `read` scope. Operation `listClientCalculations`.
|
|
34
|
+
*
|
|
35
|
+
* @param clientId - the client's id.
|
|
36
|
+
*/
|
|
37
|
+
listForClient(clientId, query, options) {
|
|
38
|
+
return callPage(this.#config, "listClientCalculations", {
|
|
39
|
+
path: { id: clientId },
|
|
40
|
+
query,
|
|
41
|
+
options,
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Reads a calculation.
|
|
46
|
+
*
|
|
47
|
+
* Needs the `read` scope. Operation `getCalculation`.
|
|
48
|
+
*/
|
|
49
|
+
get(id, options) {
|
|
50
|
+
return call(this.#config, "getCalculation", { path: { id }, options });
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Deletes a draft calculation.
|
|
54
|
+
*
|
|
55
|
+
* A retry after a lost response can answer `404` for a delete that
|
|
56
|
+
* succeeded.
|
|
57
|
+
*
|
|
58
|
+
* Needs the `write` scope. Operation `deleteCalculation`.
|
|
59
|
+
*/
|
|
60
|
+
delete(id, options) {
|
|
61
|
+
return call(this.#config, "deleteCalculation", { path: { id }, options });
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Validates a calculation: records the validation checklist, an
|
|
65
|
+
* attestation that the figures were reviewed, and moves a draft to
|
|
66
|
+
* `validated`.
|
|
67
|
+
*
|
|
68
|
+
* Needs a session token: validation is a human attestation. An API key
|
|
69
|
+
* is refused with `403` `session_required`, as an `ApiError`. Never
|
|
70
|
+
* retried.
|
|
71
|
+
*
|
|
72
|
+
* Operation `validateCalculation`.
|
|
73
|
+
*/
|
|
74
|
+
validate(id, body, options) {
|
|
75
|
+
return call(this.#config, "validateCalculation", {
|
|
76
|
+
path: { id },
|
|
77
|
+
body,
|
|
78
|
+
options,
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Publishes a calculation: moves a validated calculation to `published`.
|
|
83
|
+
* Publication is terminal.
|
|
84
|
+
*
|
|
85
|
+
* Needs a session token: publishing is a human trust step. An API key is
|
|
86
|
+
* refused with `403` `session_required`, as an `ApiError`. Never retried.
|
|
87
|
+
*
|
|
88
|
+
* Operation `publishCalculation`.
|
|
89
|
+
*/
|
|
90
|
+
publish(id, options) {
|
|
91
|
+
return call(this.#config, "publishCalculation", {
|
|
92
|
+
path: { id },
|
|
93
|
+
options,
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Reopens a calculation: moves a validated calculation back to `draft`,
|
|
98
|
+
* clearing its attestation.
|
|
99
|
+
*
|
|
100
|
+
* Needs a session token: it undoes a human trust step. An API key is
|
|
101
|
+
* refused with `403` `session_required`, as an `ApiError`. Never retried.
|
|
102
|
+
*
|
|
103
|
+
* Operation `reopenCalculation`.
|
|
104
|
+
*/
|
|
105
|
+
reopen(id, options) {
|
|
106
|
+
return call(this.#config, "reopenCalculation", {
|
|
107
|
+
path: { id },
|
|
108
|
+
options,
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { IdempotentRequestOptions, RequestOptions } from "../options.js";
|
|
2
|
+
import type { PagePromise } from "../pagination.js";
|
|
3
|
+
import type { TransportConfig } from "../transport.js";
|
|
4
|
+
import type { Client, ClientAgents, ClientAgentsSet, ClientCreate, ClientDetail, ClientList, ClientPatch, ListClientsQuery } from "../types.js";
|
|
5
|
+
/** The `clients` operations. */
|
|
6
|
+
export declare class Clients {
|
|
7
|
+
#private;
|
|
8
|
+
constructor(config: TransportConfig);
|
|
9
|
+
/**
|
|
10
|
+
* Lists clients. Await the result for one page; iterate it with
|
|
11
|
+
* `for await` for every client of every page.
|
|
12
|
+
*
|
|
13
|
+
* Needs the `read` scope. Operation `listClients`.
|
|
14
|
+
*/
|
|
15
|
+
list(query?: ListClientsQuery, options?: RequestOptions): PagePromise<Client, ClientList>;
|
|
16
|
+
/**
|
|
17
|
+
* Creates a client.
|
|
18
|
+
*
|
|
19
|
+
* Every attempt of the call sends one `Idempotency-Key`, so a retry
|
|
20
|
+
* cannot create a second client.
|
|
21
|
+
*
|
|
22
|
+
* Needs the `write` scope. Operation `createClient`.
|
|
23
|
+
*/
|
|
24
|
+
create(body: ClientCreate, options?: IdempotentRequestOptions): Promise<Client>;
|
|
25
|
+
/**
|
|
26
|
+
* Reads a client.
|
|
27
|
+
*
|
|
28
|
+
* Needs the `read` scope. Operation `getClient`.
|
|
29
|
+
*/
|
|
30
|
+
get(id: string, options?: RequestOptions): Promise<ClientDetail>;
|
|
31
|
+
/**
|
|
32
|
+
* Updates a client with a merge patch: a member left out keeps its
|
|
33
|
+
* value, `null` clears it, and any other value sets it.
|
|
34
|
+
*
|
|
35
|
+
* Never retried.
|
|
36
|
+
*
|
|
37
|
+
* Needs the `write` scope. Operation `updateClient`.
|
|
38
|
+
*/
|
|
39
|
+
update(id: string, patch: ClientPatch, options?: RequestOptions): Promise<Client>;
|
|
40
|
+
/**
|
|
41
|
+
* Deletes a client. Refused while events carry the client's key, or
|
|
42
|
+
* while the client has a validated or published calculation; set its
|
|
43
|
+
* status to `churned` instead.
|
|
44
|
+
*
|
|
45
|
+
* A retry after a lost response can answer `404` for a delete that
|
|
46
|
+
* succeeded.
|
|
47
|
+
*
|
|
48
|
+
* Needs the `write` scope. Operation `deleteClient`.
|
|
49
|
+
*/
|
|
50
|
+
delete(id: string, options?: RequestOptions): Promise<void>;
|
|
51
|
+
/**
|
|
52
|
+
* Replaces a client's assigned agents. Assignment decides how later
|
|
53
|
+
* events are attributed: an event without `client_key` from an agent
|
|
54
|
+
* assigned to exactly one client is attributed to that client. A
|
|
55
|
+
* `model` or `outcome` event from an agent assigned to two or more
|
|
56
|
+
* clients must carry `client_key`, or it is refused with
|
|
57
|
+
* `client_key_required`.
|
|
58
|
+
*
|
|
59
|
+
* Retried on a failure worth retrying, because a repeat leaves the same
|
|
60
|
+
* agents assigned.
|
|
61
|
+
*
|
|
62
|
+
* Needs the `write` scope. Operation `setClientAgents`.
|
|
63
|
+
*/
|
|
64
|
+
setAgents(id: string, body: ClientAgentsSet, options?: RequestOptions): Promise<ClientAgents>;
|
|
65
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
// The `clients` operations.
|
|
2
|
+
import { call, callPage } from "../request.js";
|
|
3
|
+
/** The `clients` operations. */
|
|
4
|
+
export class Clients {
|
|
5
|
+
#config;
|
|
6
|
+
constructor(config) {
|
|
7
|
+
this.#config = config;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Lists clients. Await the result for one page; iterate it with
|
|
11
|
+
* `for await` for every client of every page.
|
|
12
|
+
*
|
|
13
|
+
* Needs the `read` scope. Operation `listClients`.
|
|
14
|
+
*/
|
|
15
|
+
list(query, options) {
|
|
16
|
+
return callPage(this.#config, "listClients", { query, options });
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Creates a client.
|
|
20
|
+
*
|
|
21
|
+
* Every attempt of the call sends one `Idempotency-Key`, so a retry
|
|
22
|
+
* cannot create a second client.
|
|
23
|
+
*
|
|
24
|
+
* Needs the `write` scope. Operation `createClient`.
|
|
25
|
+
*/
|
|
26
|
+
create(body, options) {
|
|
27
|
+
return call(this.#config, "createClient", { body, options });
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Reads a client.
|
|
31
|
+
*
|
|
32
|
+
* Needs the `read` scope. Operation `getClient`.
|
|
33
|
+
*/
|
|
34
|
+
get(id, options) {
|
|
35
|
+
return call(this.#config, "getClient", { path: { id }, options });
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Updates a client with a merge patch: a member left out keeps its
|
|
39
|
+
* value, `null` clears it, and any other value sets it.
|
|
40
|
+
*
|
|
41
|
+
* Never retried.
|
|
42
|
+
*
|
|
43
|
+
* Needs the `write` scope. Operation `updateClient`.
|
|
44
|
+
*/
|
|
45
|
+
update(id, patch, options) {
|
|
46
|
+
return call(this.#config, "updateClient", {
|
|
47
|
+
path: { id },
|
|
48
|
+
body: patch,
|
|
49
|
+
options,
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Deletes a client. Refused while events carry the client's key, or
|
|
54
|
+
* while the client has a validated or published calculation; set its
|
|
55
|
+
* status to `churned` instead.
|
|
56
|
+
*
|
|
57
|
+
* A retry after a lost response can answer `404` for a delete that
|
|
58
|
+
* succeeded.
|
|
59
|
+
*
|
|
60
|
+
* Needs the `write` scope. Operation `deleteClient`.
|
|
61
|
+
*/
|
|
62
|
+
delete(id, options) {
|
|
63
|
+
return call(this.#config, "deleteClient", { path: { id }, options });
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Replaces a client's assigned agents. Assignment decides how later
|
|
67
|
+
* events are attributed: an event without `client_key` from an agent
|
|
68
|
+
* assigned to exactly one client is attributed to that client. A
|
|
69
|
+
* `model` or `outcome` event from an agent assigned to two or more
|
|
70
|
+
* clients must carry `client_key`, or it is refused with
|
|
71
|
+
* `client_key_required`.
|
|
72
|
+
*
|
|
73
|
+
* Retried on a failure worth retrying, because a repeat leaves the same
|
|
74
|
+
* agents assigned.
|
|
75
|
+
*
|
|
76
|
+
* Needs the `write` scope. Operation `setClientAgents`.
|
|
77
|
+
*/
|
|
78
|
+
setAgents(id, body, options) {
|
|
79
|
+
return call(this.#config, "setClientAgents", {
|
|
80
|
+
path: { id },
|
|
81
|
+
body,
|
|
82
|
+
options,
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { MoneyInput } from "../money.js";
|
|
2
|
+
import type { IdempotentRequestOptions, RequestOptions } from "../options.js";
|
|
3
|
+
import type { PagePromise } from "../pagination.js";
|
|
4
|
+
import type { TransportConfig } from "../transport.js";
|
|
5
|
+
import type { CostLineItem, CostLineItemCreate, CostLineItemList, CostLineItemPatch, ListCostLineItemsQuery, PriceTable, PriceTableSet } from "../types.js";
|
|
6
|
+
/** The `cost` operations. */
|
|
7
|
+
export declare class Cost {
|
|
8
|
+
#private;
|
|
9
|
+
constructor(config: TransportConfig);
|
|
10
|
+
/**
|
|
11
|
+
* Lists cost line items. Await the result for one page; iterate it with
|
|
12
|
+
* `for await` for every line item of every page.
|
|
13
|
+
*
|
|
14
|
+
* Needs the `read` scope. Operation `listCostLineItems`.
|
|
15
|
+
*/
|
|
16
|
+
listLineItems(query?: ListCostLineItemsQuery, options?: RequestOptions): PagePromise<CostLineItem, CostLineItemList>;
|
|
17
|
+
/**
|
|
18
|
+
* Creates a cost line item. `monthly_amount` takes a `Decimal` or a
|
|
19
|
+
* `number`.
|
|
20
|
+
*
|
|
21
|
+
* Every attempt of the call sends one `Idempotency-Key`, so a retry
|
|
22
|
+
* cannot create a second line item.
|
|
23
|
+
*
|
|
24
|
+
* Needs the `write` scope. Operation `createCostLineItem`.
|
|
25
|
+
*/
|
|
26
|
+
createLineItem(body: MoneyInput<CostLineItemCreate>, options?: IdempotentRequestOptions): Promise<CostLineItem>;
|
|
27
|
+
/**
|
|
28
|
+
* Reads a cost line item.
|
|
29
|
+
*
|
|
30
|
+
* Needs the `read` scope. Operation `getCostLineItem`.
|
|
31
|
+
*/
|
|
32
|
+
getLineItem(id: string, options?: RequestOptions): Promise<CostLineItem>;
|
|
33
|
+
/**
|
|
34
|
+
* Updates a cost line item with a merge patch: a member left out keeps
|
|
35
|
+
* its value, `null` clears it, and any other value sets it.
|
|
36
|
+
* `monthly_amount` takes a `Decimal` or a `number`.
|
|
37
|
+
*
|
|
38
|
+
* Never retried.
|
|
39
|
+
*
|
|
40
|
+
* Needs the `write` scope. Operation `updateCostLineItem`.
|
|
41
|
+
*/
|
|
42
|
+
updateLineItem(id: string, patch: MoneyInput<CostLineItemPatch>, options?: RequestOptions): Promise<CostLineItem>;
|
|
43
|
+
/**
|
|
44
|
+
* Deletes a cost line item.
|
|
45
|
+
*
|
|
46
|
+
* A retry after a lost response can answer `404` for a delete that
|
|
47
|
+
* succeeded.
|
|
48
|
+
*
|
|
49
|
+
* Needs the `write` scope. Operation `deleteCostLineItem`.
|
|
50
|
+
*/
|
|
51
|
+
deleteLineItem(id: string, options?: RequestOptions): Promise<void>;
|
|
52
|
+
/**
|
|
53
|
+
* Reads the price table.
|
|
54
|
+
*
|
|
55
|
+
* Needs the `read` scope. Operation `getPriceTable`.
|
|
56
|
+
*/
|
|
57
|
+
getPriceTable(options?: RequestOptions): Promise<PriceTable>;
|
|
58
|
+
/**
|
|
59
|
+
* Replaces the price table, as a whole. Each rate takes a `Decimal` or a
|
|
60
|
+
* `number`, so a table read with `getPriceTable` can be sent back as it
|
|
61
|
+
* is.
|
|
62
|
+
*
|
|
63
|
+
* Retried on a failure worth retrying, because a repeat leaves the same
|
|
64
|
+
* price table.
|
|
65
|
+
*
|
|
66
|
+
* Needs the `write` scope. Operation `setPriceTable`.
|
|
67
|
+
*/
|
|
68
|
+
setPriceTable(body: MoneyInput<PriceTableSet>, options?: RequestOptions): Promise<PriceTable>;
|
|
69
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
// The `cost` operations: cost line items and the price table.
|
|
2
|
+
import { call, callPage } from "../request.js";
|
|
3
|
+
/** The `cost` operations. */
|
|
4
|
+
export class Cost {
|
|
5
|
+
#config;
|
|
6
|
+
constructor(config) {
|
|
7
|
+
this.#config = config;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Lists cost line items. Await the result for one page; iterate it with
|
|
11
|
+
* `for await` for every line item of every page.
|
|
12
|
+
*
|
|
13
|
+
* Needs the `read` scope. Operation `listCostLineItems`.
|
|
14
|
+
*/
|
|
15
|
+
listLineItems(query, options) {
|
|
16
|
+
return callPage(this.#config, "listCostLineItems", { query, options });
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Creates a cost line item. `monthly_amount` takes a `Decimal` or a
|
|
20
|
+
* `number`.
|
|
21
|
+
*
|
|
22
|
+
* Every attempt of the call sends one `Idempotency-Key`, so a retry
|
|
23
|
+
* cannot create a second line item.
|
|
24
|
+
*
|
|
25
|
+
* Needs the `write` scope. Operation `createCostLineItem`.
|
|
26
|
+
*/
|
|
27
|
+
createLineItem(body, options) {
|
|
28
|
+
return call(this.#config, "createCostLineItem", { body, options });
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Reads a cost line item.
|
|
32
|
+
*
|
|
33
|
+
* Needs the `read` scope. Operation `getCostLineItem`.
|
|
34
|
+
*/
|
|
35
|
+
getLineItem(id, options) {
|
|
36
|
+
return call(this.#config, "getCostLineItem", { path: { id }, options });
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Updates a cost line item with a merge patch: a member left out keeps
|
|
40
|
+
* its value, `null` clears it, and any other value sets it.
|
|
41
|
+
* `monthly_amount` takes a `Decimal` or a `number`.
|
|
42
|
+
*
|
|
43
|
+
* Never retried.
|
|
44
|
+
*
|
|
45
|
+
* Needs the `write` scope. Operation `updateCostLineItem`.
|
|
46
|
+
*/
|
|
47
|
+
updateLineItem(id, patch, options) {
|
|
48
|
+
return call(this.#config, "updateCostLineItem", {
|
|
49
|
+
path: { id },
|
|
50
|
+
body: patch,
|
|
51
|
+
options,
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Deletes a cost line item.
|
|
56
|
+
*
|
|
57
|
+
* A retry after a lost response can answer `404` for a delete that
|
|
58
|
+
* succeeded.
|
|
59
|
+
*
|
|
60
|
+
* Needs the `write` scope. Operation `deleteCostLineItem`.
|
|
61
|
+
*/
|
|
62
|
+
deleteLineItem(id, options) {
|
|
63
|
+
return call(this.#config, "deleteCostLineItem", {
|
|
64
|
+
path: { id },
|
|
65
|
+
options,
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Reads the price table.
|
|
70
|
+
*
|
|
71
|
+
* Needs the `read` scope. Operation `getPriceTable`.
|
|
72
|
+
*/
|
|
73
|
+
getPriceTable(options) {
|
|
74
|
+
return call(this.#config, "getPriceTable", { options });
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Replaces the price table, as a whole. Each rate takes a `Decimal` or a
|
|
78
|
+
* `number`, so a table read with `getPriceTable` can be sent back as it
|
|
79
|
+
* is.
|
|
80
|
+
*
|
|
81
|
+
* Retried on a failure worth retrying, because a repeat leaves the same
|
|
82
|
+
* price table.
|
|
83
|
+
*
|
|
84
|
+
* Needs the `write` scope. Operation `setPriceTable`.
|
|
85
|
+
*/
|
|
86
|
+
setPriceTable(body, options) {
|
|
87
|
+
return call(this.#config, "setPriceTable", { body, options });
|
|
88
|
+
}
|
|
89
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { RequestOptions } from "../options.js";
|
|
2
|
+
import type { PagePromise } from "../pagination.js";
|
|
3
|
+
import type { TransportConfig } from "../transport.js";
|
|
4
|
+
import type { Dashboard, GetDashboardQuery, ListRenewalsQuery, Renewal, RenewalList } from "../types.js";
|
|
5
|
+
/** The `dashboard` operations. */
|
|
6
|
+
export declare class DashboardOperations {
|
|
7
|
+
#private;
|
|
8
|
+
constructor(config: TransportConfig);
|
|
9
|
+
/**
|
|
10
|
+
* Reads the workspace's month: its published figures for the calendar
|
|
11
|
+
* month `month`, such as `2026-08`, which is required.
|
|
12
|
+
*
|
|
13
|
+
* Needs the `read` scope. Operation `getDashboard`.
|
|
14
|
+
*/
|
|
15
|
+
get(query: GetDashboardQuery, options?: RequestOptions): Promise<Dashboard>;
|
|
16
|
+
/**
|
|
17
|
+
* Lists renewal readiness: each client's latest published figures,
|
|
18
|
+
* whatever month `get` reads. Await the result for one page; iterate it
|
|
19
|
+
* with `for await` for every client of every page.
|
|
20
|
+
*
|
|
21
|
+
* Needs the `read` scope. Operation `listRenewals`.
|
|
22
|
+
*/
|
|
23
|
+
listRenewals(query?: ListRenewalsQuery, options?: RequestOptions): PagePromise<Renewal, RenewalList>;
|
|
24
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// The `dashboard` operations.
|
|
2
|
+
import { call, callPage } from "../request.js";
|
|
3
|
+
/** The `dashboard` operations. */
|
|
4
|
+
export class DashboardOperations {
|
|
5
|
+
#config;
|
|
6
|
+
constructor(config) {
|
|
7
|
+
this.#config = config;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Reads the workspace's month: its published figures for the calendar
|
|
11
|
+
* month `month`, such as `2026-08`, which is required.
|
|
12
|
+
*
|
|
13
|
+
* Needs the `read` scope. Operation `getDashboard`.
|
|
14
|
+
*/
|
|
15
|
+
get(query, options) {
|
|
16
|
+
return call(this.#config, "getDashboard", { query, options });
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Lists renewal readiness: each client's latest published figures,
|
|
20
|
+
* whatever month `get` reads. Await the result for one page; iterate it
|
|
21
|
+
* with `for await` for every client of every page.
|
|
22
|
+
*
|
|
23
|
+
* Needs the `read` scope. Operation `listRenewals`.
|
|
24
|
+
*/
|
|
25
|
+
listRenewals(query, options) {
|
|
26
|
+
return callPage(this.#config, "listRenewals", { query, options });
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { RequestOptions } from "../options.js";
|
|
2
|
+
import type { PagePromise } from "../pagination.js";
|
|
3
|
+
import { type TransportConfig } from "../transport.js";
|
|
4
|
+
import type { AttributedEvent, ClientEventList, EventInput, IngestSummary, ListClientEventsQuery } from "../types.js";
|
|
5
|
+
/** The `events` operations. */
|
|
6
|
+
export declare class Events {
|
|
7
|
+
#private;
|
|
8
|
+
constructor(config: TransportConfig);
|
|
9
|
+
/**
|
|
10
|
+
* Ingests any number of events. They are sent in batches of at most 500
|
|
11
|
+
* events and 4,000,000 bytes, one batch after another, each retried as
|
|
12
|
+
* the client allows. Every event without an `event_id` gets a generated
|
|
13
|
+
* one, so a retry never stores an event twice. Your objects are not
|
|
14
|
+
* modified.
|
|
15
|
+
*
|
|
16
|
+
* An event too large to send even alone is not sent, and is reported as a
|
|
17
|
+
* rejected row with the code `too_large`.
|
|
18
|
+
*
|
|
19
|
+
* @returns the combined outcome over the whole list.
|
|
20
|
+
* @throws {IngestError} when a batch fails; the call stops there, and the
|
|
21
|
+
* error carries the summary so far and every event from the failed batch
|
|
22
|
+
* onward, to send again. A batch fails on an error response, on no
|
|
23
|
+
* response, on the caller's cancellation, or when its token cannot be
|
|
24
|
+
* had: an error from `tokenProvider`, or, in a browser without
|
|
25
|
+
* `dangerouslyAllowBrowser`, a provider's token that is an API key. The
|
|
26
|
+
* error is the `IngestError`'s `cause`.
|
|
27
|
+
* @throws {TypeError} when an event cannot be encoded, or `options.headers`
|
|
28
|
+
* names a header the SDK sets, before anything is sent.
|
|
29
|
+
* @throws {AllisallError} when `options.timeout` or `options.maxRetries` is
|
|
30
|
+
* one the client would refuse, before anything is sent.
|
|
31
|
+
*/
|
|
32
|
+
ingest(events: readonly EventInput[], options?: RequestOptions): Promise<IngestSummary>;
|
|
33
|
+
/**
|
|
34
|
+
* Lists the events behind a client's totals: the event drill-down, over
|
|
35
|
+
* the period `from` to `to`.
|
|
36
|
+
*
|
|
37
|
+
* Pass `page` or `cursor`, not both; neither means page 1. A `page`
|
|
38
|
+
* beyond the end returns no rows and the true `total`. Await the result
|
|
39
|
+
* for one page, whose `body` holds `total` and `period`; iterate it with
|
|
40
|
+
* `for await` for every event of every page from there.
|
|
41
|
+
*
|
|
42
|
+
* Needs the `read` scope. Operation `listClientEvents`.
|
|
43
|
+
*
|
|
44
|
+
* @param clientId - the client's id.
|
|
45
|
+
*/
|
|
46
|
+
listForClient(clientId: string, query: ListClientEventsQuery, options?: RequestOptions): PagePromise<AttributedEvent, ClientEventList>;
|
|
47
|
+
}
|