@allisall/sdk 0.1.0 → 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/README.md +142 -4
- package/dist/client.d.ts +81 -37
- package/dist/client.js +136 -73
- 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 +7 -2
- package/dist/index.js +1 -0
- package/dist/ingest.d.ts +1 -1
- package/dist/ingest.js +2 -2
- 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/runtime.d.ts +2 -0
- package/dist/runtime.js +2 -1
- package/dist/share.d.ts +52 -0
- package/dist/share.js +60 -0
- package/dist/transport.d.ts +54 -5
- package/dist/transport.js +81 -32
- package/dist/types.d.ts +135 -2
- package/dist/types.js +12 -3
- package/dist/unicode.d.ts +2 -0
- package/dist/unicode.js +11 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +4 -3
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
// The `events` operations: ingest, and the event drill-down.
|
|
2
|
+
import { OPERATIONS } from "../generated/operations.js";
|
|
3
|
+
import { ingest, readIngestResult } from "../ingest.js";
|
|
4
|
+
import { callPage, policyOf } from "../request.js";
|
|
5
|
+
import { post } from "../transport.js";
|
|
6
|
+
/** The `events` operations. */
|
|
7
|
+
export class Events {
|
|
8
|
+
#config;
|
|
9
|
+
constructor(config) {
|
|
10
|
+
this.#config = config;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Ingests any number of events. They are sent in batches of at most 500
|
|
14
|
+
* events and 4,000,000 bytes, one batch after another, each retried as
|
|
15
|
+
* the client allows. Every event without an `event_id` gets a generated
|
|
16
|
+
* one, so a retry never stores an event twice. Your objects are not
|
|
17
|
+
* modified.
|
|
18
|
+
*
|
|
19
|
+
* An event too large to send even alone is not sent, and is reported as a
|
|
20
|
+
* rejected row with the code `too_large`.
|
|
21
|
+
*
|
|
22
|
+
* @returns the combined outcome over the whole list.
|
|
23
|
+
* @throws {IngestError} when a batch fails; the call stops there, and the
|
|
24
|
+
* error carries the summary so far and every event from the failed batch
|
|
25
|
+
* onward, to send again. A batch fails on an error response, on no
|
|
26
|
+
* response, on the caller's cancellation, or when its token cannot be
|
|
27
|
+
* had: an error from `tokenProvider`, or, in a browser without
|
|
28
|
+
* `dangerouslyAllowBrowser`, a provider's token that is an API key. The
|
|
29
|
+
* error is the `IngestError`'s `cause`.
|
|
30
|
+
* @throws {TypeError} when an event cannot be encoded, or `options.headers`
|
|
31
|
+
* names a header the SDK sets, before anything is sent.
|
|
32
|
+
* @throws {AllisallError} when `options.timeout` or `options.maxRetries` is
|
|
33
|
+
* one the client would refuse, before anything is sent.
|
|
34
|
+
*/
|
|
35
|
+
ingest(events, options = {}) {
|
|
36
|
+
const config = this.#config;
|
|
37
|
+
let policy;
|
|
38
|
+
try {
|
|
39
|
+
policy = policyOf(config, "ingestEvents", OPERATIONS.ingestEvents, options);
|
|
40
|
+
}
|
|
41
|
+
catch (err) {
|
|
42
|
+
return Promise.reject(err);
|
|
43
|
+
}
|
|
44
|
+
// Each batch has its own signal; ingest is always eligible for a retry,
|
|
45
|
+
// because event_id deduplicates, which post() sets.
|
|
46
|
+
const { timeout, maxRetries, headers } = policy;
|
|
47
|
+
return ingest(events, (body, count, signal) => post(config, OPERATIONS.ingestEvents.path, body, (value) => readIngestResult(value, count), { timeout, maxRetries, headers, signal }), options.signal);
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Lists the events behind a client's totals: the event drill-down, over
|
|
51
|
+
* the period `from` to `to`.
|
|
52
|
+
*
|
|
53
|
+
* Pass `page` or `cursor`, not both; neither means page 1. A `page`
|
|
54
|
+
* beyond the end returns no rows and the true `total`. Await the result
|
|
55
|
+
* for one page, whose `body` holds `total` and `period`; iterate it with
|
|
56
|
+
* `for await` for every event of every page from there.
|
|
57
|
+
*
|
|
58
|
+
* Needs the `read` scope. Operation `listClientEvents`.
|
|
59
|
+
*
|
|
60
|
+
* @param clientId - the client's id.
|
|
61
|
+
*/
|
|
62
|
+
listForClient(clientId, query, options) {
|
|
63
|
+
return callPage(this.#config, "listClientEvents", {
|
|
64
|
+
path: { id: clientId },
|
|
65
|
+
query,
|
|
66
|
+
options,
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { RequestOptions } from "../options.js";
|
|
2
|
+
import type { TransportConfig } from "../transport.js";
|
|
3
|
+
import type { Health } from "../types.js";
|
|
4
|
+
/** The `health` operations. */
|
|
5
|
+
export declare class HealthOperations {
|
|
6
|
+
#private;
|
|
7
|
+
constructor(config: TransportConfig);
|
|
8
|
+
/**
|
|
9
|
+
* Checks liveness. Sends no credential.
|
|
10
|
+
*
|
|
11
|
+
* Operation `getHealth`.
|
|
12
|
+
*/
|
|
13
|
+
get(options?: RequestOptions): Promise<Health>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// The `health` operations.
|
|
2
|
+
import { call } from "../request.js";
|
|
3
|
+
/** The `health` operations. */
|
|
4
|
+
export class HealthOperations {
|
|
5
|
+
#config;
|
|
6
|
+
constructor(config) {
|
|
7
|
+
this.#config = config;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Checks liveness. Sends no credential.
|
|
11
|
+
*
|
|
12
|
+
* Operation `getHealth`.
|
|
13
|
+
*/
|
|
14
|
+
get(options) {
|
|
15
|
+
return call(this.#config, "getHealth", { options });
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { ImportUpload } from "../multipart.js";
|
|
2
|
+
import type { IdempotentRequestOptions, RequestOptions } from "../options.js";
|
|
3
|
+
import type { TransportConfig } from "../transport.js";
|
|
4
|
+
import type { ImportPreview, ImportResult } from "../types.js";
|
|
5
|
+
/** The `imports` operations. */
|
|
6
|
+
export declare class Imports {
|
|
7
|
+
#private;
|
|
8
|
+
constructor(config: TransportConfig);
|
|
9
|
+
/**
|
|
10
|
+
* Previews a CSV import: parses, maps and validates the file exactly as
|
|
11
|
+
* `commit` would, and writes nothing.
|
|
12
|
+
*
|
|
13
|
+
* Never retried, although it writes nothing; repeat the call to try
|
|
14
|
+
* again.
|
|
15
|
+
*
|
|
16
|
+
* Needs the `ingest` scope. Operation `previewImport`.
|
|
17
|
+
*/
|
|
18
|
+
preview(upload: ImportUpload, options?: RequestOptions): Promise<ImportPreview>;
|
|
19
|
+
/**
|
|
20
|
+
* Imports a CSV file: stores its valid rows and records an import batch.
|
|
21
|
+
* A problem with one row rejects that row only. The result lists the
|
|
22
|
+
* problems of the rejected rows, one `errors` entry per problem, up to the
|
|
23
|
+
* first 1,000; `errors_truncated` says when more were omitted, and the
|
|
24
|
+
* counts always cover the whole file. Events deduplicate as they do on
|
|
25
|
+
* ingest.
|
|
26
|
+
*
|
|
27
|
+
* Every attempt of the call sends one `Idempotency-Key`, so a retry
|
|
28
|
+
* cannot record a second import batch.
|
|
29
|
+
*
|
|
30
|
+
* Needs the `ingest` scope. Operation `commitImport`.
|
|
31
|
+
*/
|
|
32
|
+
commit(upload: ImportUpload, options?: IdempotentRequestOptions): Promise<ImportResult>;
|
|
33
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// The `imports` operations: a CSV file of events, previewed or committed.
|
|
2
|
+
import { call } from "../request.js";
|
|
3
|
+
/** The `imports` operations. */
|
|
4
|
+
export class Imports {
|
|
5
|
+
#config;
|
|
6
|
+
constructor(config) {
|
|
7
|
+
this.#config = config;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Previews a CSV import: parses, maps and validates the file exactly as
|
|
11
|
+
* `commit` would, and writes nothing.
|
|
12
|
+
*
|
|
13
|
+
* Never retried, although it writes nothing; repeat the call to try
|
|
14
|
+
* again.
|
|
15
|
+
*
|
|
16
|
+
* Needs the `ingest` scope. Operation `previewImport`.
|
|
17
|
+
*/
|
|
18
|
+
preview(upload, options) {
|
|
19
|
+
return call(this.#config, "previewImport", { body: upload, options });
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Imports a CSV file: stores its valid rows and records an import batch.
|
|
23
|
+
* A problem with one row rejects that row only. The result lists the
|
|
24
|
+
* problems of the rejected rows, one `errors` entry per problem, up to the
|
|
25
|
+
* first 1,000; `errors_truncated` says when more were omitted, and the
|
|
26
|
+
* counts always cover the whole file. Events deduplicate as they do on
|
|
27
|
+
* ingest.
|
|
28
|
+
*
|
|
29
|
+
* Every attempt of the call sends one `Idempotency-Key`, so a retry
|
|
30
|
+
* cannot record a second import batch.
|
|
31
|
+
*
|
|
32
|
+
* Needs the `ingest` scope. Operation `commitImport`.
|
|
33
|
+
*/
|
|
34
|
+
commit(upload, options) {
|
|
35
|
+
return call(this.#config, "commitImport", { body: upload, options });
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { RequestOptions } from "../options.js";
|
|
2
|
+
import type { PagePromise } from "../pagination.js";
|
|
3
|
+
import type { TransportConfig } from "../transport.js";
|
|
4
|
+
import type { ListClientOutcomeTypesQuery, ListOutcomeTypesQuery, OutcomeTypeList, OutcomeTypeUsage } from "../types.js";
|
|
5
|
+
/** The `outcomeTypes` operations. */
|
|
6
|
+
export declare class OutcomeTypes {
|
|
7
|
+
#private;
|
|
8
|
+
constructor(config: TransportConfig);
|
|
9
|
+
/**
|
|
10
|
+
* Lists the workspace's outcome types. Await the result for one page;
|
|
11
|
+
* iterate it with `for await` for every outcome type of every page.
|
|
12
|
+
*
|
|
13
|
+
* Needs the `read` scope. Operation `listOutcomeTypes`.
|
|
14
|
+
*/
|
|
15
|
+
list(query?: ListOutcomeTypesQuery, options?: RequestOptions): PagePromise<OutcomeTypeUsage, OutcomeTypeList>;
|
|
16
|
+
/**
|
|
17
|
+
* Lists a client's outcome types. Await the result for one page; iterate
|
|
18
|
+
* it with `for await` for every outcome type of every page.
|
|
19
|
+
*
|
|
20
|
+
* Needs the `read` scope. Operation `listClientOutcomeTypes`.
|
|
21
|
+
*
|
|
22
|
+
* @param clientId - the client's id.
|
|
23
|
+
*/
|
|
24
|
+
listForClient(clientId: string, query?: ListClientOutcomeTypesQuery, options?: RequestOptions): PagePromise<OutcomeTypeUsage, OutcomeTypeList>;
|
|
25
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// The `outcomeTypes` operations.
|
|
2
|
+
import { callPage } from "../request.js";
|
|
3
|
+
/** The `outcomeTypes` operations. */
|
|
4
|
+
export class OutcomeTypes {
|
|
5
|
+
#config;
|
|
6
|
+
constructor(config) {
|
|
7
|
+
this.#config = config;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Lists the workspace's outcome types. Await the result for one page;
|
|
11
|
+
* iterate it with `for await` for every outcome type of every page.
|
|
12
|
+
*
|
|
13
|
+
* Needs the `read` scope. Operation `listOutcomeTypes`.
|
|
14
|
+
*/
|
|
15
|
+
list(query, options) {
|
|
16
|
+
return callPage(this.#config, "listOutcomeTypes", { query, options });
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Lists a client's outcome types. Await the result for one page; iterate
|
|
20
|
+
* it with `for await` for every outcome type of every page.
|
|
21
|
+
*
|
|
22
|
+
* Needs the `read` scope. Operation `listClientOutcomeTypes`.
|
|
23
|
+
*
|
|
24
|
+
* @param clientId - the client's id.
|
|
25
|
+
*/
|
|
26
|
+
listForClient(clientId, query, options) {
|
|
27
|
+
return callPage(this.#config, "listClientOutcomeTypes", {
|
|
28
|
+
path: { id: clientId },
|
|
29
|
+
query,
|
|
30
|
+
options,
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
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 { ListCalculationReportsQuery, Report, ReportList, ReportPatch, ReportSummary, ReportWithPreview } from "../types.js";
|
|
5
|
+
/** The `reports` operations. */
|
|
6
|
+
export declare class Reports {
|
|
7
|
+
#private;
|
|
8
|
+
constructor(config: TransportConfig);
|
|
9
|
+
/**
|
|
10
|
+
* Composes a report on a published calculation, with its disclosures
|
|
11
|
+
* taken from the calculation's coverage.
|
|
12
|
+
*
|
|
13
|
+
* Every attempt of the call sends one `Idempotency-Key`, so a retry
|
|
14
|
+
* cannot create a second report.
|
|
15
|
+
*
|
|
16
|
+
* Needs the `write` scope. Operation `createReport`.
|
|
17
|
+
*
|
|
18
|
+
* @param calculationId - the calculation's id.
|
|
19
|
+
*/
|
|
20
|
+
createForCalculation(calculationId: string, options?: IdempotentRequestOptions): Promise<Report>;
|
|
21
|
+
/**
|
|
22
|
+
* Lists a calculation's reports. Await the result for one page; iterate
|
|
23
|
+
* it with `for await` for every report of every page. Each item is a
|
|
24
|
+
* summary without `disclosures`; `get` reads a report with them.
|
|
25
|
+
*
|
|
26
|
+
* Needs the `read` scope. Operation `listCalculationReports`.
|
|
27
|
+
*
|
|
28
|
+
* @param calculationId - the calculation's id.
|
|
29
|
+
*/
|
|
30
|
+
listForCalculation(calculationId: string, query?: ListCalculationReportsQuery, options?: RequestOptions): PagePromise<ReportSummary, ReportList>;
|
|
31
|
+
/**
|
|
32
|
+
* Reads a report.
|
|
33
|
+
*
|
|
34
|
+
* Needs the `read` scope. Operation `getReport`.
|
|
35
|
+
*/
|
|
36
|
+
get(id: string, options?: RequestOptions): Promise<ReportWithPreview>;
|
|
37
|
+
/**
|
|
38
|
+
* Edits a report with a merge patch: a member left out keeps its value,
|
|
39
|
+
* `null` clears it, and any other value sets it. An array, such as
|
|
40
|
+
* `disclosures`, replaces the stored one whole.
|
|
41
|
+
*
|
|
42
|
+
* Never retried.
|
|
43
|
+
*
|
|
44
|
+
* Needs the `write` scope. Operation `updateReport`.
|
|
45
|
+
*/
|
|
46
|
+
update(id: string, patch: ReportPatch, options?: RequestOptions): Promise<Report>;
|
|
47
|
+
/**
|
|
48
|
+
* Deletes an unshared report. A shared report cannot be deleted; revoke
|
|
49
|
+
* its link instead.
|
|
50
|
+
*
|
|
51
|
+
* A retry after a lost response can answer `404` for a delete that
|
|
52
|
+
* succeeded.
|
|
53
|
+
*
|
|
54
|
+
* Needs the `write` scope. Operation `deleteReport`.
|
|
55
|
+
*/
|
|
56
|
+
delete(id: string, options?: RequestOptions): Promise<void>;
|
|
57
|
+
/**
|
|
58
|
+
* Shares a report: mints its share token and seals the report against
|
|
59
|
+
* edits. Anyone holding the token can read the report, so handle it like
|
|
60
|
+
* a secret.
|
|
61
|
+
*
|
|
62
|
+
* Needs a session token: sharing is a human trust step. An API key is
|
|
63
|
+
* refused with `403` `session_required`, as an `ApiError`. Never retried.
|
|
64
|
+
*
|
|
65
|
+
* Operation `shareReport`.
|
|
66
|
+
*/
|
|
67
|
+
share(id: string, options?: RequestOptions): Promise<Report>;
|
|
68
|
+
/**
|
|
69
|
+
* Revokes a report's link: its share token stops working.
|
|
70
|
+
*
|
|
71
|
+
* Needs a session token: it undoes a human trust step. An API key is
|
|
72
|
+
* refused with `403` `session_required`, as an `ApiError`. Never retried.
|
|
73
|
+
*
|
|
74
|
+
* Operation `revokeReport`.
|
|
75
|
+
*/
|
|
76
|
+
revoke(id: string, options?: RequestOptions): Promise<Report>;
|
|
77
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
// The `reports` operations: a report on a published calculation, and the
|
|
2
|
+
// human steps that share it and revoke its link.
|
|
3
|
+
import { call, callPage } from "../request.js";
|
|
4
|
+
/** The `reports` operations. */
|
|
5
|
+
export class Reports {
|
|
6
|
+
#config;
|
|
7
|
+
constructor(config) {
|
|
8
|
+
this.#config = config;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Composes a report on a published calculation, with its disclosures
|
|
12
|
+
* taken from the calculation's coverage.
|
|
13
|
+
*
|
|
14
|
+
* Every attempt of the call sends one `Idempotency-Key`, so a retry
|
|
15
|
+
* cannot create a second report.
|
|
16
|
+
*
|
|
17
|
+
* Needs the `write` scope. Operation `createReport`.
|
|
18
|
+
*
|
|
19
|
+
* @param calculationId - the calculation's id.
|
|
20
|
+
*/
|
|
21
|
+
createForCalculation(calculationId, options) {
|
|
22
|
+
return call(this.#config, "createReport", {
|
|
23
|
+
path: { id: calculationId },
|
|
24
|
+
options,
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Lists a calculation's reports. Await the result for one page; iterate
|
|
29
|
+
* it with `for await` for every report of every page. Each item is a
|
|
30
|
+
* summary without `disclosures`; `get` reads a report with them.
|
|
31
|
+
*
|
|
32
|
+
* Needs the `read` scope. Operation `listCalculationReports`.
|
|
33
|
+
*
|
|
34
|
+
* @param calculationId - the calculation's id.
|
|
35
|
+
*/
|
|
36
|
+
listForCalculation(calculationId, query, options) {
|
|
37
|
+
return callPage(this.#config, "listCalculationReports", {
|
|
38
|
+
path: { id: calculationId },
|
|
39
|
+
query,
|
|
40
|
+
options,
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Reads a report.
|
|
45
|
+
*
|
|
46
|
+
* Needs the `read` scope. Operation `getReport`.
|
|
47
|
+
*/
|
|
48
|
+
get(id, options) {
|
|
49
|
+
return call(this.#config, "getReport", { path: { id }, options });
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Edits a report with a merge patch: a member left out keeps its value,
|
|
53
|
+
* `null` clears it, and any other value sets it. An array, such as
|
|
54
|
+
* `disclosures`, replaces the stored one whole.
|
|
55
|
+
*
|
|
56
|
+
* Never retried.
|
|
57
|
+
*
|
|
58
|
+
* Needs the `write` scope. Operation `updateReport`.
|
|
59
|
+
*/
|
|
60
|
+
update(id, patch, options) {
|
|
61
|
+
return call(this.#config, "updateReport", {
|
|
62
|
+
path: { id },
|
|
63
|
+
body: patch,
|
|
64
|
+
options,
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Deletes an unshared report. A shared report cannot be deleted; revoke
|
|
69
|
+
* its link instead.
|
|
70
|
+
*
|
|
71
|
+
* A retry after a lost response can answer `404` for a delete that
|
|
72
|
+
* succeeded.
|
|
73
|
+
*
|
|
74
|
+
* Needs the `write` scope. Operation `deleteReport`.
|
|
75
|
+
*/
|
|
76
|
+
delete(id, options) {
|
|
77
|
+
return call(this.#config, "deleteReport", { path: { id }, options });
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Shares a report: mints its share token and seals the report against
|
|
81
|
+
* edits. Anyone holding the token can read the report, so handle it like
|
|
82
|
+
* a secret.
|
|
83
|
+
*
|
|
84
|
+
* Needs a session token: sharing is a human trust step. An API key is
|
|
85
|
+
* refused with `403` `session_required`, as an `ApiError`. Never retried.
|
|
86
|
+
*
|
|
87
|
+
* Operation `shareReport`.
|
|
88
|
+
*/
|
|
89
|
+
share(id, options) {
|
|
90
|
+
return call(this.#config, "shareReport", { path: { id }, options });
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Revokes a report's link: its share token stops working.
|
|
94
|
+
*
|
|
95
|
+
* Needs a session token: it undoes a human trust step. An API key is
|
|
96
|
+
* refused with `403` `session_required`, as an `ApiError`. Never retried.
|
|
97
|
+
*
|
|
98
|
+
* Operation `revokeReport`.
|
|
99
|
+
*/
|
|
100
|
+
revoke(id, options) {
|
|
101
|
+
return call(this.#config, "revokeReport", { path: { id }, options });
|
|
102
|
+
}
|
|
103
|
+
}
|