@pilot-status/sdk 0.4.0 → 0.8.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/CHANGELOG.md +51 -0
- package/README.md +203 -17
- package/dist/client.d.ts +53 -2
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +54 -4
- package/dist/client.js.map +1 -1
- package/dist/errors.d.ts +58 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +65 -0
- package/dist/errors.js.map +1 -1
- package/dist/http.d.ts +7 -1
- package/dist/http.d.ts.map +1 -1
- package/dist/http.js +3 -0
- package/dist/http.js.map +1 -1
- package/dist/index.d.ts +12 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -3
- package/dist/index.js.map +1 -1
- package/dist/internal.d.ts +19 -0
- package/dist/internal.d.ts.map +1 -0
- package/dist/internal.js +27 -0
- package/dist/internal.js.map +1 -0
- package/dist/resources/api-keys.d.ts +20 -7
- package/dist/resources/api-keys.d.ts.map +1 -1
- package/dist/resources/api-keys.js +18 -5
- package/dist/resources/api-keys.js.map +1 -1
- package/dist/resources/billing.d.ts +18 -0
- package/dist/resources/billing.d.ts.map +1 -0
- package/dist/resources/billing.js +30 -0
- package/dist/resources/billing.js.map +1 -0
- package/dist/resources/branding.d.ts +18 -0
- package/dist/resources/branding.d.ts.map +1 -0
- package/dist/resources/branding.js +29 -0
- package/dist/resources/branding.js.map +1 -0
- package/dist/resources/chatwoot.d.ts +57 -0
- package/dist/resources/chatwoot.d.ts.map +1 -0
- package/dist/resources/chatwoot.js +117 -0
- package/dist/resources/chatwoot.js.map +1 -0
- package/dist/resources/conversations.d.ts +16 -0
- package/dist/resources/conversations.d.ts.map +1 -0
- package/dist/resources/conversations.js +28 -0
- package/dist/resources/conversations.js.map +1 -0
- package/dist/resources/embed.d.ts +24 -0
- package/dist/resources/embed.d.ts.map +1 -0
- package/dist/resources/embed.js +37 -0
- package/dist/resources/embed.js.map +1 -0
- package/dist/resources/flows.d.ts +203 -0
- package/dist/resources/flows.d.ts.map +1 -0
- package/dist/resources/flows.js +289 -0
- package/dist/resources/flows.js.map +1 -0
- package/dist/resources/groups.d.ts +37 -1
- package/dist/resources/groups.d.ts.map +1 -1
- package/dist/resources/groups.js +91 -0
- package/dist/resources/groups.js.map +1 -1
- package/dist/resources/messages.d.ts +61 -1
- package/dist/resources/messages.d.ts.map +1 -1
- package/dist/resources/messages.js +134 -1
- package/dist/resources/messages.js.map +1 -1
- package/dist/resources/meta.d.ts +19 -0
- package/dist/resources/meta.d.ts.map +1 -0
- package/dist/resources/meta.js +31 -0
- package/dist/resources/meta.js.map +1 -0
- package/dist/resources/numbers.d.ts +102 -1
- package/dist/resources/numbers.d.ts.map +1 -1
- package/dist/resources/numbers.js +152 -0
- package/dist/resources/numbers.js.map +1 -1
- package/dist/resources/service-window.d.ts +20 -0
- package/dist/resources/service-window.d.ts.map +1 -0
- package/dist/resources/service-window.js +26 -0
- package/dist/resources/service-window.js.map +1 -0
- package/dist/resources/subscription.d.ts +43 -0
- package/dist/resources/subscription.d.ts.map +1 -0
- package/dist/resources/subscription.js +60 -0
- package/dist/resources/subscription.js.map +1 -0
- package/dist/resources/templates.d.ts +31 -1
- package/dist/resources/templates.d.ts.map +1 -1
- package/dist/resources/templates.js +56 -0
- package/dist/resources/templates.js.map +1 -1
- package/dist/resources/webhooks.d.ts +53 -0
- package/dist/resources/webhooks.d.ts.map +1 -0
- package/dist/resources/webhooks.js +97 -0
- package/dist/resources/webhooks.js.map +1 -0
- package/dist/resources/workspace.d.ts +57 -0
- package/dist/resources/workspace.d.ts.map +1 -0
- package/dist/resources/workspace.js +73 -0
- package/dist/resources/workspace.js.map +1 -0
- package/dist/types.d.ts +957 -21
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/webhooks/parse.d.ts +16 -0
- package/dist/webhooks/parse.d.ts.map +1 -1
- package/dist/webhooks/parse.js +49 -0
- package/dist/webhooks/parse.js.map +1 -1
- package/dist/webhooks/signature.d.ts +42 -0
- package/dist/webhooks/signature.d.ts.map +1 -0
- package/dist/webhooks/signature.js +40 -0
- package/dist/webhooks/signature.js.map +1 -0
- package/dist/webhooks/types.d.ts +59 -1
- package/dist/webhooks/types.d.ts.map +1 -1
- package/package.json +5 -3
- package/dist/messages.test.d.ts +0 -2
- package/dist/messages.test.d.ts.map +0 -1
- package/dist/messages.test.js +0 -107
- package/dist/messages.test.js.map +0 -1
- package/dist/numbers.test.d.ts +0 -2
- package/dist/numbers.test.d.ts.map +0 -1
- package/dist/numbers.test.js +0 -57
- package/dist/numbers.test.js.map +0 -1
- package/dist/resources/groups.test.d.ts +0 -2
- package/dist/resources/groups.test.d.ts.map +0 -1
- package/dist/resources/groups.test.js +0 -19
- package/dist/resources/groups.test.js.map +0 -1
- package/dist/resources/newsletters.test.d.ts +0 -2
- package/dist/resources/newsletters.test.d.ts.map +0 -1
- package/dist/resources/newsletters.test.js +0 -19
- package/dist/resources/newsletters.test.js.map +0 -1
- package/dist/resources/projects.d.ts +0 -9
- package/dist/resources/projects.d.ts.map +0 -1
- package/dist/resources/projects.js +0 -23
- package/dist/resources/projects.js.map +0 -1
- package/dist/resources/templates.test.d.ts +0 -2
- package/dist/resources/templates.test.d.ts.map +0 -1
- package/dist/resources/templates.test.js +0 -28
- package/dist/resources/templates.test.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subscription.d.ts","sourceRoot":"","sources":["../../src/resources/subscription.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C,OAAO,KAAK,EACR,mBAAmB,EACnB,0BAA0B,EAC1B,0BAA0B,EAC7B,MAAM,aAAa,CAAC;AAErB;;;;;;;;GAQG;AACH,qBAAa,oBAAoB;;gBAGjB,IAAI,EAAE,UAAU;IAI5B,qFAAqF;IAC/E,mBAAmB,CAAC,MAAM,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAQvF;;;;;OAKG;IACG,eAAe,CAAC,KAAK,CAAC,EAAE;QAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,OAAO,CAAC,EAAE,OAAO,CAAC;KACrB,GAAG,OAAO,CAAC,0BAA0B,CAAC;IAQvC;;;;;;;OAOG;IACG,eAAe,CAAC,KAAK,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,0BAA0B,CAAC;IAQzF,8GAA8G;IACxG,sBAAsB,IAAI,OAAO,CAAC,0BAA0B,CAAC;CAMtE"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { compact } from "../internal.js";
|
|
2
|
+
/**
|
|
3
|
+
* Paid number capacity (`/v1/subscription/extra-numbers*`). Requires a
|
|
4
|
+
* tenant-scoped credential.
|
|
5
|
+
*
|
|
6
|
+
* ⚠️ **Paid capacity ≠ connected number.** `numbers.delete()` frees the SLOT so
|
|
7
|
+
* another number can be connected, and does not cut a single cent off the bill.
|
|
8
|
+
* Reducing what you pay is {@link scheduleRemoval}, and it only takes effect on
|
|
9
|
+
* the following cycle.
|
|
10
|
+
*/
|
|
11
|
+
export class SubscriptionResource {
|
|
12
|
+
#http;
|
|
13
|
+
constructor(http) {
|
|
14
|
+
this.#http = http;
|
|
15
|
+
}
|
|
16
|
+
/** Cost preview for buying `quantity` extra numbers (default 1). Charges nothing. */
|
|
17
|
+
async previewExtraNumbers(params) {
|
|
18
|
+
return this.#http.requestJson({
|
|
19
|
+
method: "GET",
|
|
20
|
+
path: "/v1/subscription/extra-numbers",
|
|
21
|
+
query: compact({ quantity: params?.quantity }),
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Buys `quantity` extra numbers. On a FREE plan this CONVERTS the account to
|
|
26
|
+
* On Demand, which is why it requires `confirm: true` — without it the server
|
|
27
|
+
* refuses, so that nobody changes plan by accident. With no card on file, the
|
|
28
|
+
* response carries a `checkoutUrl` instead of charging.
|
|
29
|
+
*/
|
|
30
|
+
async addExtraNumbers(input) {
|
|
31
|
+
return this.#http.requestJson({
|
|
32
|
+
method: "POST",
|
|
33
|
+
path: "/v1/subscription/extra-numbers",
|
|
34
|
+
body: compact({ quantity: input?.quantity, confirm: input?.confirm }),
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* SCHEDULES the return of `quantity` paid slots for the next cycle.
|
|
39
|
+
*
|
|
40
|
+
* Nothing changes right now and there is no refund: paid capacity is a 30-day
|
|
41
|
+
* entitlement. Calling it again OVERWRITES the scheduled target (it does not
|
|
42
|
+
* accumulate). It answers 409 `NUMBER_LIMIT_EXCEEDED` if the target would fall
|
|
43
|
+
* below the numbers currently connected.
|
|
44
|
+
*/
|
|
45
|
+
async scheduleRemoval(input) {
|
|
46
|
+
return this.#http.requestJson({
|
|
47
|
+
method: "DELETE",
|
|
48
|
+
path: "/v1/subscription/extra-numbers",
|
|
49
|
+
body: compact({ quantity: input?.quantity }),
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
/** Cancels the scheduled reduction — the next cycle keeps the current capacity. A no-op if there was none. */
|
|
53
|
+
async cancelScheduledRemoval() {
|
|
54
|
+
return this.#http.requestJson({
|
|
55
|
+
method: "DELETE",
|
|
56
|
+
path: "/v1/subscription/extra-numbers/schedule",
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=subscription.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subscription.js","sourceRoot":"","sources":["../../src/resources/subscription.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAOzC;;;;;;;;GAQG;AACH,MAAM,OAAO,oBAAoB;IACpB,KAAK,CAAa;IAE3B,YAAY,IAAgB;QACxB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACtB,CAAC;IAED,qFAAqF;IACrF,KAAK,CAAC,mBAAmB,CAAC,MAA8B;QACpD,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,CAAsB;YAC/C,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,gCAAgC;YACtC,KAAK,EAAE,OAAO,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;SACjD,CAAC,CAAC;IACP,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,eAAe,CAAC,KAGrB;QACG,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,CAA6B;YACtD,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,gCAAgC;YACtC,IAAI,EAAE,OAAO,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;SACxE,CAAC,CAAC;IACP,CAAC;IAED;;;;;;;OAOG;IACH,KAAK,CAAC,eAAe,CAAC,KAA6B;QAC/C,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,CAA6B;YACtD,MAAM,EAAE,QAAQ;YAChB,IAAI,EAAE,gCAAgC;YACtC,IAAI,EAAE,OAAO,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC;SAC/C,CAAC,CAAC;IACP,CAAC;IAED,8GAA8G;IAC9G,KAAK,CAAC,sBAAsB;QACxB,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,CAA6B;YACtD,MAAM,EAAE,QAAQ;YAChB,IAAI,EAAE,yCAAyC;SAClD,CAAC,CAAC;IACP,CAAC;CACJ"}
|
|
@@ -1,9 +1,39 @@
|
|
|
1
1
|
import type { HttpClient } from "../http.js";
|
|
2
|
-
import type { TemplateDetail, TemplateListItem } from "../types.js";
|
|
2
|
+
import type { CreateTemplateInput, TemplateDeleteResult, TemplateDetail, TemplateListItem, UpdateTemplateInput } from "../types.js";
|
|
3
3
|
export declare class TemplatesResource {
|
|
4
4
|
#private;
|
|
5
5
|
constructor(http: HttpClient);
|
|
6
|
+
/**
|
|
7
|
+
* ⚠️ Only `sendable: true` can be passed to `messages.send()`. On a Meta
|
|
8
|
+
* number that means a `source: "META"` template with
|
|
9
|
+
* `metaStatus: "APPROVED"` — PILOT_STATUS templates and Meta ones in
|
|
10
|
+
* PENDING/REJECTED show up in the list and do **not** send.
|
|
11
|
+
*/
|
|
6
12
|
list(): Promise<TemplateListItem[]>;
|
|
7
13
|
get(id: string): Promise<TemplateDetail>;
|
|
14
|
+
/**
|
|
15
|
+
* Creates a template on the key's number (and submits it to Meta, on a Meta
|
|
16
|
+
* number).
|
|
17
|
+
*
|
|
18
|
+
* `examples` is MANDATORY, with one value per `{{variable}}` in the body,
|
|
19
|
+
* otherwise the API rejects with `TEMPLATE_EXAMPLES_REQUIRED`. Only pass `{}`
|
|
20
|
+
* when the body has no variables at all.
|
|
21
|
+
*/
|
|
22
|
+
create(input: CreateTemplateInput): Promise<TemplateDetail>;
|
|
23
|
+
/** Rewrites the body (and re-submits it to Meta). `examples` is still mandatory, for the NEW body. */
|
|
24
|
+
update(id: string, input: UpdateTemplateInput): Promise<TemplateDetail>;
|
|
25
|
+
/**
|
|
26
|
+
* Deletes the template (on Meta too, when it is a Meta template). Irreversible.
|
|
27
|
+
*
|
|
28
|
+
* If Meta REFUSES the deletion — a token without permission on the WABA, for
|
|
29
|
+
* instance — the call fails with `409 META_TEMPLATE_DELETE_REFUSED` and
|
|
30
|
+
* **nothing** is deleted. Do not blindly retry: `forceLocalDelete` only
|
|
31
|
+
* removes our copy, and the template SURVIVES on Meta consuming quota and
|
|
32
|
+
* holding the name, until a future sync possibly brings it back. It is an
|
|
33
|
+
* escape hatch for an orphaned row, not a retry.
|
|
34
|
+
*/
|
|
35
|
+
delete(id: string, options?: {
|
|
36
|
+
forceLocalDelete?: boolean;
|
|
37
|
+
}): Promise<TemplateDeleteResult>;
|
|
8
38
|
}
|
|
9
39
|
//# sourceMappingURL=templates.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../src/resources/templates.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../src/resources/templates.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C,OAAO,KAAK,EACR,mBAAmB,EACnB,oBAAoB,EACpB,cAAc,EACd,gBAAgB,EAChB,mBAAmB,EACtB,MAAM,aAAa,CAAC;AAErB,qBAAa,iBAAiB;;gBAGd,IAAI,EAAE,UAAU;IAI5B;;;;;OAKG;IACG,IAAI,IAAI,OAAO,CAAC,gBAAgB,EAAE,CAAC;IAOnC,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IAO9C;;;;;;;OAOG;IACG,MAAM,CAAC,KAAK,EAAE,mBAAmB,GAAG,OAAO,CAAC,cAAc,CAAC;IAejE,sGAAsG;IAChG,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,mBAAmB,GAAG,OAAO,CAAC,cAAc,CAAC;IAQ7E;;;;;;;;;OASG;IACG,MAAM,CACR,EAAE,EAAE,MAAM,EACV,OAAO,GAAE;QAAE,gBAAgB,CAAC,EAAE,OAAO,CAAA;KAAO,GAC7C,OAAO,CAAC,oBAAoB,CAAC;CASnC"}
|
|
@@ -1,8 +1,15 @@
|
|
|
1
|
+
import { compact } from "../internal.js";
|
|
1
2
|
export class TemplatesResource {
|
|
2
3
|
#http;
|
|
3
4
|
constructor(http) {
|
|
4
5
|
this.#http = http;
|
|
5
6
|
}
|
|
7
|
+
/**
|
|
8
|
+
* ⚠️ Only `sendable: true` can be passed to `messages.send()`. On a Meta
|
|
9
|
+
* number that means a `source: "META"` template with
|
|
10
|
+
* `metaStatus: "APPROVED"` — PILOT_STATUS templates and Meta ones in
|
|
11
|
+
* PENDING/REJECTED show up in the list and do **not** send.
|
|
12
|
+
*/
|
|
6
13
|
async list() {
|
|
7
14
|
return this.#http.requestJson({
|
|
8
15
|
method: "GET",
|
|
@@ -15,5 +22,54 @@ export class TemplatesResource {
|
|
|
15
22
|
path: `/v1/templates/${encodeURIComponent(id)}`,
|
|
16
23
|
});
|
|
17
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* Creates a template on the key's number (and submits it to Meta, on a Meta
|
|
27
|
+
* number).
|
|
28
|
+
*
|
|
29
|
+
* `examples` is MANDATORY, with one value per `{{variable}}` in the body,
|
|
30
|
+
* otherwise the API rejects with `TEMPLATE_EXAMPLES_REQUIRED`. Only pass `{}`
|
|
31
|
+
* when the body has no variables at all.
|
|
32
|
+
*/
|
|
33
|
+
async create(input) {
|
|
34
|
+
return this.#http.requestJson({
|
|
35
|
+
method: "POST",
|
|
36
|
+
path: "/v1/templates",
|
|
37
|
+
body: compact({
|
|
38
|
+
name: input.name,
|
|
39
|
+
body: input.body,
|
|
40
|
+
examples: input.examples,
|
|
41
|
+
category: input.category,
|
|
42
|
+
variables: input.variables,
|
|
43
|
+
language: input.language,
|
|
44
|
+
}),
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
/** Rewrites the body (and re-submits it to Meta). `examples` is still mandatory, for the NEW body. */
|
|
48
|
+
async update(id, input) {
|
|
49
|
+
return this.#http.requestJson({
|
|
50
|
+
method: "PUT",
|
|
51
|
+
path: `/v1/templates/${encodeURIComponent(id)}`,
|
|
52
|
+
body: { body: input.body, examples: input.examples },
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Deletes the template (on Meta too, when it is a Meta template). Irreversible.
|
|
57
|
+
*
|
|
58
|
+
* If Meta REFUSES the deletion — a token without permission on the WABA, for
|
|
59
|
+
* instance — the call fails with `409 META_TEMPLATE_DELETE_REFUSED` and
|
|
60
|
+
* **nothing** is deleted. Do not blindly retry: `forceLocalDelete` only
|
|
61
|
+
* removes our copy, and the template SURVIVES on Meta consuming quota and
|
|
62
|
+
* holding the name, until a future sync possibly brings it back. It is an
|
|
63
|
+
* escape hatch for an orphaned row, not a retry.
|
|
64
|
+
*/
|
|
65
|
+
async delete(id, options = {}) {
|
|
66
|
+
return this.#http.requestJson({
|
|
67
|
+
method: "DELETE",
|
|
68
|
+
path: `/v1/templates/${encodeURIComponent(id)}`,
|
|
69
|
+
query: compact({
|
|
70
|
+
force_local: options.forceLocalDelete ? "true" : undefined,
|
|
71
|
+
}),
|
|
72
|
+
});
|
|
73
|
+
}
|
|
18
74
|
}
|
|
19
75
|
//# sourceMappingURL=templates.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"templates.js","sourceRoot":"","sources":["../../src/resources/templates.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"templates.js","sourceRoot":"","sources":["../../src/resources/templates.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AASzC,MAAM,OAAO,iBAAiB;IACjB,KAAK,CAAa;IAE3B,YAAY,IAAgB;QACxB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACtB,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,IAAI;QACN,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,CAAqB;YAC9C,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,eAAe;SACxB,CAAC,CAAC;IACP,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,EAAU;QAChB,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,CAAiB;YAC1C,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,iBAAiB,kBAAkB,CAAC,EAAE,CAAC,EAAE;SAClD,CAAC,CAAC;IACP,CAAC;IAED;;;;;;;OAOG;IACH,KAAK,CAAC,MAAM,CAAC,KAA0B;QACnC,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,CAAiB;YAC1C,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,eAAe;YACrB,IAAI,EAAE,OAAO,CAAC;gBACV,IAAI,EAAE,KAAK,CAAC,IAAI;gBAChB,IAAI,EAAE,KAAK,CAAC,IAAI;gBAChB,QAAQ,EAAE,KAAK,CAAC,QAAQ;gBACxB,QAAQ,EAAE,KAAK,CAAC,QAAQ;gBACxB,SAAS,EAAE,KAAK,CAAC,SAAS;gBAC1B,QAAQ,EAAE,KAAK,CAAC,QAAQ;aAC3B,CAAC;SACL,CAAC,CAAC;IACP,CAAC;IAED,sGAAsG;IACtG,KAAK,CAAC,MAAM,CAAC,EAAU,EAAE,KAA0B;QAC/C,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,CAAiB;YAC1C,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,iBAAiB,kBAAkB,CAAC,EAAE,CAAC,EAAE;YAC/C,IAAI,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE;SACvD,CAAC,CAAC;IACP,CAAC;IAED;;;;;;;;;OASG;IACH,KAAK,CAAC,MAAM,CACR,EAAU,EACV,UAA0C,EAAE;QAE5C,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,CAAuB;YAChD,MAAM,EAAE,QAAQ;YAChB,IAAI,EAAE,iBAAiB,kBAAkB,CAAC,EAAE,CAAC,EAAE;YAC/C,KAAK,EAAE,OAAO,CAAC;gBACX,WAAW,EAAE,OAAO,CAAC,gBAAgB,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS;aAC7D,CAAC;SACL,CAAC,CAAC;IACP,CAAC;CACJ"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { HttpClient } from "../http.js";
|
|
2
|
+
import type { CreateWebhookInput, UpdateWebhookInput, Webhook, WebhookDeleteResult, WebhookLogEntry, WebhookLogsParams } from "../types.js";
|
|
3
|
+
/**
|
|
4
|
+
* CRUD of the webhook subscriptions (`/v1/webhooks*`).
|
|
5
|
+
*
|
|
6
|
+
* ⚠️ The signing `secret` NEVER comes back in any of these responses — anyone who
|
|
7
|
+
* could read it would be able to FORGE signed events for the customer's endpoint.
|
|
8
|
+
* It is shown only once, in the dashboard. To validate a received delivery use
|
|
9
|
+
* {@link ../webhooks/signature.js#verifyWebhookSignature}.
|
|
10
|
+
*/
|
|
11
|
+
export declare class WebhooksResource {
|
|
12
|
+
#private;
|
|
13
|
+
constructor(http: HttpClient);
|
|
14
|
+
/**
|
|
15
|
+
* The webhooks visible to the credential's scope.
|
|
16
|
+
*
|
|
17
|
+
* With a number in play (a number key, or `whatsappNumberId` on the client)
|
|
18
|
+
* the list is STRICTLY that number's webhooks — legacy webhooks with no
|
|
19
|
+
* subscription at all are left out on purpose.
|
|
20
|
+
*/
|
|
21
|
+
list(): Promise<Webhook[]>;
|
|
22
|
+
/**
|
|
23
|
+
* Creates a webhook bound to ONE number.
|
|
24
|
+
*
|
|
25
|
+
* An empty or omitted `events` **fires nothing**: there is no implicit
|
|
26
|
+
* subscribe-to-everything — pass `["*"]` for all of them. Events the number's
|
|
27
|
+
* provider does not emit are silently discarded.
|
|
28
|
+
*
|
|
29
|
+
* With a tenant-scoped key and no `whatsappNumberId` on the client, the body's
|
|
30
|
+
* `whatsappNumberId` field is mandatory (400 `NUMBER_REQUIRED`).
|
|
31
|
+
*/
|
|
32
|
+
create(input: CreateWebhookInput): Promise<Webhook>;
|
|
33
|
+
get(id: string): Promise<Webhook>;
|
|
34
|
+
/**
|
|
35
|
+
* Partial update. `events` is a REPLACEMENT of the whole list, not a merge —
|
|
36
|
+
* sending `[]` turns off every delivery without deleting the webhook (the same
|
|
37
|
+
* as `active: false`, by a different route).
|
|
38
|
+
*
|
|
39
|
+
* A webhook's number is not editable: delete it and recreate it.
|
|
40
|
+
*/
|
|
41
|
+
update(id: string, input: UpdateWebhookInput): Promise<Webhook>;
|
|
42
|
+
/** Irreversible: deletes the subscription and the delivery logs. To merely pause, use `update(id, { active: false })`. */
|
|
43
|
+
delete(id: string): Promise<WebhookDeleteResult>;
|
|
44
|
+
/**
|
|
45
|
+
* Recent delivery attempts (`limit` 1–50).
|
|
46
|
+
*
|
|
47
|
+
* ⚠️ On a per-number OAuth connection this route answers 400 `NUMBER_REQUIRED`
|
|
48
|
+
* without `x-whatsapp-number-id` — build the client with `whatsappNumberId`,
|
|
49
|
+
* or use `client.withNumber(id).webhooks.logs(...)`.
|
|
50
|
+
*/
|
|
51
|
+
logs(id: string, params?: WebhookLogsParams): Promise<WebhookLogEntry[]>;
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=webhooks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webhooks.d.ts","sourceRoot":"","sources":["../../src/resources/webhooks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C,OAAO,KAAK,EACR,kBAAkB,EAClB,kBAAkB,EAClB,OAAO,EACP,mBAAmB,EACnB,eAAe,EACf,iBAAiB,EACpB,MAAM,aAAa,CAAC;AAErB;;;;;;;GAOG;AACH,qBAAa,gBAAgB;;gBAGb,IAAI,EAAE,UAAU;IAI5B;;;;;;OAMG;IACG,IAAI,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;IAOhC;;;;;;;;;OASG;IACG,MAAM,CAAC,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAAC,OAAO,CAAC;IAanD,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAOvC;;;;;;OAMG;IACG,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAAC,OAAO,CAAC;IAarE,0HAA0H;IACpH,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAOtD;;;;;;OAMG;IACG,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;CAOjF"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { compact } from "../internal.js";
|
|
2
|
+
/**
|
|
3
|
+
* CRUD of the webhook subscriptions (`/v1/webhooks*`).
|
|
4
|
+
*
|
|
5
|
+
* ⚠️ The signing `secret` NEVER comes back in any of these responses — anyone who
|
|
6
|
+
* could read it would be able to FORGE signed events for the customer's endpoint.
|
|
7
|
+
* It is shown only once, in the dashboard. To validate a received delivery use
|
|
8
|
+
* {@link ../webhooks/signature.js#verifyWebhookSignature}.
|
|
9
|
+
*/
|
|
10
|
+
export class WebhooksResource {
|
|
11
|
+
#http;
|
|
12
|
+
constructor(http) {
|
|
13
|
+
this.#http = http;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* The webhooks visible to the credential's scope.
|
|
17
|
+
*
|
|
18
|
+
* With a number in play (a number key, or `whatsappNumberId` on the client)
|
|
19
|
+
* the list is STRICTLY that number's webhooks — legacy webhooks with no
|
|
20
|
+
* subscription at all are left out on purpose.
|
|
21
|
+
*/
|
|
22
|
+
async list() {
|
|
23
|
+
return this.#http.requestJson({
|
|
24
|
+
method: "GET",
|
|
25
|
+
path: "/v1/webhooks",
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Creates a webhook bound to ONE number.
|
|
30
|
+
*
|
|
31
|
+
* An empty or omitted `events` **fires nothing**: there is no implicit
|
|
32
|
+
* subscribe-to-everything — pass `["*"]` for all of them. Events the number's
|
|
33
|
+
* provider does not emit are silently discarded.
|
|
34
|
+
*
|
|
35
|
+
* With a tenant-scoped key and no `whatsappNumberId` on the client, the body's
|
|
36
|
+
* `whatsappNumberId` field is mandatory (400 `NUMBER_REQUIRED`).
|
|
37
|
+
*/
|
|
38
|
+
async create(input) {
|
|
39
|
+
return this.#http.requestJson({
|
|
40
|
+
method: "POST",
|
|
41
|
+
path: "/v1/webhooks",
|
|
42
|
+
body: compact({
|
|
43
|
+
url: input.url,
|
|
44
|
+
name: input.name,
|
|
45
|
+
events: input.events,
|
|
46
|
+
whatsappNumberId: input.whatsappNumberId,
|
|
47
|
+
}),
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
async get(id) {
|
|
51
|
+
return this.#http.requestJson({
|
|
52
|
+
method: "GET",
|
|
53
|
+
path: `/v1/webhooks/${encodeURIComponent(id)}`,
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Partial update. `events` is a REPLACEMENT of the whole list, not a merge —
|
|
58
|
+
* sending `[]` turns off every delivery without deleting the webhook (the same
|
|
59
|
+
* as `active: false`, by a different route).
|
|
60
|
+
*
|
|
61
|
+
* A webhook's number is not editable: delete it and recreate it.
|
|
62
|
+
*/
|
|
63
|
+
async update(id, input) {
|
|
64
|
+
return this.#http.requestJson({
|
|
65
|
+
method: "PATCH",
|
|
66
|
+
path: `/v1/webhooks/${encodeURIComponent(id)}`,
|
|
67
|
+
body: compact({
|
|
68
|
+
name: input.name,
|
|
69
|
+
url: input.url,
|
|
70
|
+
active: input.active,
|
|
71
|
+
events: input.events,
|
|
72
|
+
}),
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
/** Irreversible: deletes the subscription and the delivery logs. To merely pause, use `update(id, { active: false })`. */
|
|
76
|
+
async delete(id) {
|
|
77
|
+
return this.#http.requestJson({
|
|
78
|
+
method: "DELETE",
|
|
79
|
+
path: `/v1/webhooks/${encodeURIComponent(id)}`,
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Recent delivery attempts (`limit` 1–50).
|
|
84
|
+
*
|
|
85
|
+
* ⚠️ On a per-number OAuth connection this route answers 400 `NUMBER_REQUIRED`
|
|
86
|
+
* without `x-whatsapp-number-id` — build the client with `whatsappNumberId`,
|
|
87
|
+
* or use `client.withNumber(id).webhooks.logs(...)`.
|
|
88
|
+
*/
|
|
89
|
+
async logs(id, params) {
|
|
90
|
+
return this.#http.requestJson({
|
|
91
|
+
method: "GET",
|
|
92
|
+
path: `/v1/webhooks/${encodeURIComponent(id)}/logs`,
|
|
93
|
+
query: compact({ limit: params?.limit, event: params?.event }),
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
//# sourceMappingURL=webhooks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webhooks.js","sourceRoot":"","sources":["../../src/resources/webhooks.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAUzC;;;;;;;GAOG;AACH,MAAM,OAAO,gBAAgB;IAChB,KAAK,CAAa;IAE3B,YAAY,IAAgB;QACxB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACtB,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,IAAI;QACN,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,CAAY;YACrC,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,cAAc;SACvB,CAAC,CAAC;IACP,CAAC;IAED;;;;;;;;;OASG;IACH,KAAK,CAAC,MAAM,CAAC,KAAyB;QAClC,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,CAAU;YACnC,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,cAAc;YACpB,IAAI,EAAE,OAAO,CAAC;gBACV,GAAG,EAAE,KAAK,CAAC,GAAG;gBACd,IAAI,EAAE,KAAK,CAAC,IAAI;gBAChB,MAAM,EAAE,KAAK,CAAC,MAAM;gBACpB,gBAAgB,EAAE,KAAK,CAAC,gBAAgB;aAC3C,CAAC;SACL,CAAC,CAAC;IACP,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,EAAU;QAChB,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,CAAU;YACnC,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,gBAAgB,kBAAkB,CAAC,EAAE,CAAC,EAAE;SACjD,CAAC,CAAC;IACP,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,MAAM,CAAC,EAAU,EAAE,KAAyB;QAC9C,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,CAAU;YACnC,MAAM,EAAE,OAAO;YACf,IAAI,EAAE,gBAAgB,kBAAkB,CAAC,EAAE,CAAC,EAAE;YAC9C,IAAI,EAAE,OAAO,CAAC;gBACV,IAAI,EAAE,KAAK,CAAC,IAAI;gBAChB,GAAG,EAAE,KAAK,CAAC,GAAG;gBACd,MAAM,EAAE,KAAK,CAAC,MAAM;gBACpB,MAAM,EAAE,KAAK,CAAC,MAAM;aACvB,CAAC;SACL,CAAC,CAAC;IACP,CAAC;IAED,0HAA0H;IAC1H,KAAK,CAAC,MAAM,CAAC,EAAU;QACnB,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,CAAsB;YAC/C,MAAM,EAAE,QAAQ;YAChB,IAAI,EAAE,gBAAgB,kBAAkB,CAAC,EAAE,CAAC,EAAE;SACjD,CAAC,CAAC;IACP,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,IAAI,CAAC,EAAU,EAAE,MAA0B;QAC7C,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,CAAoB;YAC7C,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,gBAAgB,kBAAkB,CAAC,EAAE,CAAC,OAAO;YACnD,KAAK,EAAE,OAAO,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;SACjE,CAAC,CAAC;IACP,CAAC;CACJ"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { HttpClient } from "../http.js";
|
|
2
|
+
import type { WorkspaceDetail, WorkspaceMember, WorkspaceMemberList } from "../types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Workspace members — **read-only**.
|
|
5
|
+
*
|
|
6
|
+
* Inviting, resending an invite, changing a role and removing DO EXIST in `/v1`,
|
|
7
|
+
* but they only accept an OAuth principal: member writes require a user on the
|
|
8
|
+
* wire, and a `ps_` key has none (`ApiKey.createdByUserId` is provenance, not
|
|
9
|
+
* authorization). Since this SDK only speaks `x-api-key`, exposing `invite()`
|
|
10
|
+
* here would mean publishing a method that answers
|
|
11
|
+
* `403 MACHINE_CREDENTIAL_CANNOT_MANAGE_MEMBERS` 100% of the time — a trap, not a
|
|
12
|
+
* feature. Use the dashboard or an OAuth connector.
|
|
13
|
+
*/
|
|
14
|
+
export declare class WorkspaceMembersResource {
|
|
15
|
+
#private;
|
|
16
|
+
constructor(http: HttpClient);
|
|
17
|
+
/**
|
|
18
|
+
* ACTIVE and PENDING members in a single list (`GET /v1/workspace/members`).
|
|
19
|
+
*
|
|
20
|
+
* A pending invite NEVER carries a token nor an `inviteUrl`: we only store the
|
|
21
|
+
* hash, so the link is not re-derivable once it has been issued.
|
|
22
|
+
*
|
|
23
|
+
* Requires a tenant-scoped credential; a number key gets a 403.
|
|
24
|
+
*
|
|
25
|
+
* ⚠️ The route answers an ENVELOPE — `{ members, seatsUsed, seatLimit }` — and
|
|
26
|
+
* `requestJson` hands the parsed body straight back. Without the unwrap below,
|
|
27
|
+
* this method resolved to that object while claiming to be an array, so the
|
|
28
|
+
* first `.map()` a caller wrote threw `map is not a function`. Use
|
|
29
|
+
* {@link listWithSeats} when the seat counters matter.
|
|
30
|
+
*/
|
|
31
|
+
list(): Promise<WorkspaceMember[]>;
|
|
32
|
+
/**
|
|
33
|
+
* The same call as {@link list}, returning the route's body verbatim so the
|
|
34
|
+
* seat counters are not thrown away.
|
|
35
|
+
*
|
|
36
|
+
* `seatsUsed` and `seatLimit` are the ones `GET /v1/workspace` reports, sent
|
|
37
|
+
* here too so "who is in the workspace" and "is there room for one more" cost
|
|
38
|
+
* a single round trip. `seatsUsed` counts ACTIVE members **and** PENDING
|
|
39
|
+
* invites still inside their window — an invite holds its seat, otherwise the
|
|
40
|
+
* cap would be bypassable by mass-inviting.
|
|
41
|
+
*/
|
|
42
|
+
listWithSeats(): Promise<WorkspaceMemberList>;
|
|
43
|
+
}
|
|
44
|
+
/** The credential's workspace (account) — read-only. */
|
|
45
|
+
export declare class WorkspaceResource {
|
|
46
|
+
#private;
|
|
47
|
+
readonly members: WorkspaceMembersResource;
|
|
48
|
+
constructor(http: HttpClient);
|
|
49
|
+
/**
|
|
50
|
+
* `GET /v1/workspace` — `{ id, name, plan, seatsUsed, seatLimit }`.
|
|
51
|
+
*
|
|
52
|
+
* `seatsUsed` counts ACTIVE members **and** PENDING invites: an invite already
|
|
53
|
+
* holds the seat, otherwise the cap would be bypassable by mass-inviting.
|
|
54
|
+
*/
|
|
55
|
+
get(): Promise<WorkspaceDetail>;
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=workspace.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace.d.ts","sourceRoot":"","sources":["../../src/resources/workspace.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAEzF;;;;;;;;;;GAUG;AACH,qBAAa,wBAAwB;;gBAGrB,IAAI,EAAE,UAAU;IAI5B;;;;;;;;;;;;;OAaG;IACG,IAAI,IAAI,OAAO,CAAC,eAAe,EAAE,CAAC;IAKxC;;;;;;;;;OASG;IACG,aAAa,IAAI,OAAO,CAAC,mBAAmB,CAAC;CAMtD;AAED,wDAAwD;AACxD,qBAAa,iBAAiB;;IAE1B,QAAQ,CAAC,OAAO,EAAE,wBAAwB,CAAC;gBAE/B,IAAI,EAAE,UAAU;IAK5B;;;;;OAKG;IACG,GAAG,IAAI,OAAO,CAAC,eAAe,CAAC;CAMxC"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Workspace members — **read-only**.
|
|
3
|
+
*
|
|
4
|
+
* Inviting, resending an invite, changing a role and removing DO EXIST in `/v1`,
|
|
5
|
+
* but they only accept an OAuth principal: member writes require a user on the
|
|
6
|
+
* wire, and a `ps_` key has none (`ApiKey.createdByUserId` is provenance, not
|
|
7
|
+
* authorization). Since this SDK only speaks `x-api-key`, exposing `invite()`
|
|
8
|
+
* here would mean publishing a method that answers
|
|
9
|
+
* `403 MACHINE_CREDENTIAL_CANNOT_MANAGE_MEMBERS` 100% of the time — a trap, not a
|
|
10
|
+
* feature. Use the dashboard or an OAuth connector.
|
|
11
|
+
*/
|
|
12
|
+
export class WorkspaceMembersResource {
|
|
13
|
+
#http;
|
|
14
|
+
constructor(http) {
|
|
15
|
+
this.#http = http;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* ACTIVE and PENDING members in a single list (`GET /v1/workspace/members`).
|
|
19
|
+
*
|
|
20
|
+
* A pending invite NEVER carries a token nor an `inviteUrl`: we only store the
|
|
21
|
+
* hash, so the link is not re-derivable once it has been issued.
|
|
22
|
+
*
|
|
23
|
+
* Requires a tenant-scoped credential; a number key gets a 403.
|
|
24
|
+
*
|
|
25
|
+
* ⚠️ The route answers an ENVELOPE — `{ members, seatsUsed, seatLimit }` — and
|
|
26
|
+
* `requestJson` hands the parsed body straight back. Without the unwrap below,
|
|
27
|
+
* this method resolved to that object while claiming to be an array, so the
|
|
28
|
+
* first `.map()` a caller wrote threw `map is not a function`. Use
|
|
29
|
+
* {@link listWithSeats} when the seat counters matter.
|
|
30
|
+
*/
|
|
31
|
+
async list() {
|
|
32
|
+
const page = await this.listWithSeats();
|
|
33
|
+
return page.members;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* The same call as {@link list}, returning the route's body verbatim so the
|
|
37
|
+
* seat counters are not thrown away.
|
|
38
|
+
*
|
|
39
|
+
* `seatsUsed` and `seatLimit` are the ones `GET /v1/workspace` reports, sent
|
|
40
|
+
* here too so "who is in the workspace" and "is there room for one more" cost
|
|
41
|
+
* a single round trip. `seatsUsed` counts ACTIVE members **and** PENDING
|
|
42
|
+
* invites still inside their window — an invite holds its seat, otherwise the
|
|
43
|
+
* cap would be bypassable by mass-inviting.
|
|
44
|
+
*/
|
|
45
|
+
async listWithSeats() {
|
|
46
|
+
return this.#http.requestJson({
|
|
47
|
+
method: "GET",
|
|
48
|
+
path: "/v1/workspace/members",
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
/** The credential's workspace (account) — read-only. */
|
|
53
|
+
export class WorkspaceResource {
|
|
54
|
+
#http;
|
|
55
|
+
members;
|
|
56
|
+
constructor(http) {
|
|
57
|
+
this.#http = http;
|
|
58
|
+
this.members = new WorkspaceMembersResource(http);
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* `GET /v1/workspace` — `{ id, name, plan, seatsUsed, seatLimit }`.
|
|
62
|
+
*
|
|
63
|
+
* `seatsUsed` counts ACTIVE members **and** PENDING invites: an invite already
|
|
64
|
+
* holds the seat, otherwise the cap would be bypassable by mass-inviting.
|
|
65
|
+
*/
|
|
66
|
+
async get() {
|
|
67
|
+
return this.#http.requestJson({
|
|
68
|
+
method: "GET",
|
|
69
|
+
path: "/v1/workspace",
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=workspace.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace.js","sourceRoot":"","sources":["../../src/resources/workspace.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;GAUG;AACH,MAAM,OAAO,wBAAwB;IACxB,KAAK,CAAa;IAE3B,YAAY,IAAgB;QACxB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACtB,CAAC;IAED;;;;;;;;;;;;;OAaG;IACH,KAAK,CAAC,IAAI;QACN,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,aAAa,EAAE,CAAC;QACxC,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;IAED;;;;;;;;;OASG;IACH,KAAK,CAAC,aAAa;QACf,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,CAAsB;YAC/C,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,uBAAuB;SAChC,CAAC,CAAC;IACP,CAAC;CACJ;AAED,wDAAwD;AACxD,MAAM,OAAO,iBAAiB;IACjB,KAAK,CAAa;IAClB,OAAO,CAA2B;IAE3C,YAAY,IAAgB;QACxB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,IAAI,CAAC,OAAO,GAAG,IAAI,wBAAwB,CAAC,IAAI,CAAC,CAAC;IACtD,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,GAAG;QACL,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,CAAkB;YAC3C,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,eAAe;SACxB,CAAC,CAAC;IACP,CAAC;CACJ"}
|