@pilot-status/sdk 0.17.0 → 0.19.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 +80 -0
- package/README.md +121 -3
- package/dist/client.d.ts +38 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +24 -0
- package/dist/client.js.map +1 -1
- package/dist/http.d.ts +6 -0
- 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 +6 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -2
- package/dist/index.js.map +1 -1
- package/dist/resources/billing.d.ts +58 -8
- package/dist/resources/billing.d.ts.map +1 -1
- package/dist/resources/billing.js +96 -7
- package/dist/resources/billing.js.map +1 -1
- package/dist/resources/messages.d.ts.map +1 -1
- package/dist/resources/messages.js +8 -1
- package/dist/resources/messages.js.map +1 -1
- package/dist/resources/phone-lines.d.ts +55 -1
- package/dist/resources/phone-lines.d.ts.map +1 -1
- package/dist/resources/phone-lines.js +94 -0
- package/dist/resources/phone-lines.js.map +1 -1
- package/dist/resources/workspace-webhooks.d.ts +46 -0
- package/dist/resources/workspace-webhooks.d.ts.map +1 -0
- package/dist/resources/workspace-webhooks.js +83 -0
- package/dist/resources/workspace-webhooks.js.map +1 -0
- package/dist/resources/workspace.d.ts +3 -0
- package/dist/resources/workspace.d.ts.map +1 -1
- package/dist/resources/workspace.js +4 -0
- package/dist/resources/workspace.js.map +1 -1
- package/dist/resources/workspaces.d.ts +47 -0
- package/dist/resources/workspaces.d.ts.map +1 -0
- package/dist/resources/workspaces.js +75 -0
- package/dist/resources/workspaces.js.map +1 -0
- package/dist/types.d.ts +401 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/webhooks/types.d.ts +20 -0
- package/dist/webhooks/types.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { HttpClient } from "../http.js";
|
|
2
|
+
import { WorkspaceWebhooksResource } from "./workspace-webhooks.js";
|
|
2
3
|
import type { WorkspaceDetail, WorkspaceMember, WorkspaceMemberList } from "../types.js";
|
|
3
4
|
/**
|
|
4
5
|
* Workspace members — **read-only**.
|
|
@@ -43,6 +44,8 @@ export declare class WorkspaceMembersResource {
|
|
|
43
44
|
export declare class WorkspaceResource {
|
|
44
45
|
#private;
|
|
45
46
|
readonly members: WorkspaceMembersResource;
|
|
47
|
+
/** Workspace webhooks (`/v1/workspace/webhooks*`): phone-line and wallet events. */
|
|
48
|
+
readonly webhooks: WorkspaceWebhooksResource;
|
|
46
49
|
constructor(http: HttpClient);
|
|
47
50
|
/**
|
|
48
51
|
* `GET /v1/workspace` — `{ id, name, plan, seatsUsed, seatLimit }`.
|
|
@@ -1 +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;;;;;;;OAOG;IACG,aAAa,IAAI,OAAO,CAAC,mBAAmB,CAAC;CAMtD;AAED,wDAAwD;AACxD,qBAAa,iBAAiB;;IAE1B,QAAQ,CAAC,OAAO,EAAE,wBAAwB,CAAC;
|
|
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,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AACpE,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;;;;;;;OAOG;IACG,aAAa,IAAI,OAAO,CAAC,mBAAmB,CAAC;CAMtD;AAED,wDAAwD;AACxD,qBAAa,iBAAiB;;IAE1B,QAAQ,CAAC,OAAO,EAAE,wBAAwB,CAAC;IAC3C,oFAAoF;IACpF,QAAQ,CAAC,QAAQ,EAAE,yBAAyB,CAAC;gBAEjC,IAAI,EAAE,UAAU;IAM5B;;;;;OAKG;IACG,GAAG,IAAI,OAAO,CAAC,eAAe,CAAC;CAMxC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { WorkspaceWebhooksResource } from "./workspace-webhooks.js";
|
|
1
2
|
/**
|
|
2
3
|
* Workspace members — **read-only**.
|
|
3
4
|
*
|
|
@@ -51,9 +52,12 @@ export class WorkspaceMembersResource {
|
|
|
51
52
|
export class WorkspaceResource {
|
|
52
53
|
#http;
|
|
53
54
|
members;
|
|
55
|
+
/** Workspace webhooks (`/v1/workspace/webhooks*`): phone-line and wallet events. */
|
|
56
|
+
webhooks;
|
|
54
57
|
constructor(http) {
|
|
55
58
|
this.#http = http;
|
|
56
59
|
this.members = new WorkspaceMembersResource(http);
|
|
60
|
+
this.webhooks = new WorkspaceWebhooksResource(http);
|
|
57
61
|
}
|
|
58
62
|
/**
|
|
59
63
|
* `GET /v1/workspace` — `{ id, name, plan, seatsUsed, seatLimit }`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workspace.js","sourceRoot":"","sources":["../../src/resources/workspace.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"workspace.js","sourceRoot":"","sources":["../../src/resources/workspace.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AAGpE;;;;;;;;;;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;;;;;;;OAOG;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;IAC3C,oFAAoF;IAC3E,QAAQ,CAA4B;IAE7C,YAAY,IAAgB;QACxB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,IAAI,CAAC,OAAO,GAAG,IAAI,wBAAwB,CAAC,IAAI,CAAC,CAAC;QAClD,IAAI,CAAC,QAAQ,GAAG,IAAI,yBAAyB,CAAC,IAAI,CAAC,CAAC;IACxD,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"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { HttpClient } from "../http.js";
|
|
2
|
+
import type { AccountWorkspaceList, CreatedWorkspace, CreatedWorkspaceKey, CreateWorkspaceInput, CreateWorkspaceKeyInput, RevokedWorkspaceKey, WorkspaceKeyList } from "../types.js";
|
|
3
|
+
/**
|
|
4
|
+
* The keys of ONE workspace (`/v1/workspaces/{id}/api-keys*`), managed with an ACCOUNT
|
|
5
|
+
* key and the user's LIVE role there. Not a member (or the workspace does not exist /
|
|
6
|
+
* is archived) → 403 `WORKSPACE_MEMBERSHIP_REQUIRED`.
|
|
7
|
+
*/
|
|
8
|
+
export declare class WorkspaceApiKeysResource {
|
|
9
|
+
#private;
|
|
10
|
+
constructor(http: HttpClient);
|
|
11
|
+
/** `GET /v1/workspaces/{id}/api-keys` — the workspace's keys, MASKED (ADMIN and up). */
|
|
12
|
+
list(workspaceId: string): Promise<WorkspaceKeyList>;
|
|
13
|
+
/**
|
|
14
|
+
* `POST /v1/workspaces/{id}/api-keys` → HTTP 201 — mints a NAMED `ps_workspace_`
|
|
15
|
+
* key (never the primary); `apiKey.key` is shown ONCE. ADMIN and up. 409
|
|
16
|
+
* `WORKSPACE_KEY_LIMIT_REACHED` (with `limit`) at the cap. Not idempotent.
|
|
17
|
+
*/
|
|
18
|
+
create(workspaceId: string, input: CreateWorkspaceKeyInput): Promise<CreatedWorkspaceKey>;
|
|
19
|
+
/**
|
|
20
|
+
* `DELETE /v1/workspaces/{id}/api-keys/{keyId}` — revokes a NAMED key (effective on
|
|
21
|
+
* the next request). The primary key is 409 `PRIMARY_KEY_NOT_REVOCABLE` (rotate it
|
|
22
|
+
* with `POST /v1/api-keys/regenerate` and `workspaceId` instead); an unknown id is 404 `API_KEY_NOT_FOUND`.
|
|
23
|
+
*/
|
|
24
|
+
revoke(workspaceId: string, keyId: string): Promise<RevokedWorkspaceKey>;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Account-level workspaces (`/v1/workspaces*`). ⛔ ACCOUNT key (`ps_account_`) ONLY —
|
|
28
|
+
* any other credential (workspace key, number key, OAuth token) is 403
|
|
29
|
+
* `ACCOUNT_KEY_REQUIRED`. `workspaceId` is not needed here: these routes name their
|
|
30
|
+
* workspace in the path. Every method resolves to the response body untouched.
|
|
31
|
+
*/
|
|
32
|
+
export declare class WorkspacesResource {
|
|
33
|
+
#private;
|
|
34
|
+
readonly apiKeys: WorkspaceApiKeysResource;
|
|
35
|
+
constructor(http: HttpClient);
|
|
36
|
+
/** `GET /v1/workspaces` — the workspaces the key's user is an ACTIVE member of, with their role. */
|
|
37
|
+
list(): Promise<AccountWorkspaceList>;
|
|
38
|
+
/**
|
|
39
|
+
* `POST /v1/workspaces` → HTTP 201 — a workspace owned by the key's user, with its
|
|
40
|
+
* PRIMARY key in `apiKey` (shown once; `null` if minting failed — then mint one with
|
|
41
|
+
* `apiKeys.create()`, do NOT create the workspace again). 409
|
|
42
|
+
* `WORKSPACE_LIMIT_REACHED` (with `limit`) at the user's ceiling. Not idempotent,
|
|
43
|
+
* never retried by the SDK.
|
|
44
|
+
*/
|
|
45
|
+
create(input: CreateWorkspaceInput): Promise<CreatedWorkspace>;
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=workspaces.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspaces.d.ts","sourceRoot":"","sources":["../../src/resources/workspaces.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,KAAK,EACR,oBAAoB,EACpB,gBAAgB,EAChB,mBAAmB,EACnB,oBAAoB,EACpB,uBAAuB,EACvB,mBAAmB,EACnB,gBAAgB,EACnB,MAAM,aAAa,CAAC;AAQrB;;;;GAIG;AACH,qBAAa,wBAAwB;;gBAGrB,IAAI,EAAE,UAAU;IAI5B,wFAAwF;IAClF,IAAI,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAI1D;;;;OAIG;IACG,MAAM,CAAC,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,uBAAuB,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAQ/F;;;;OAIG;IACG,MAAM,CAAC,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC;CAMjF;AAED;;;;;GAKG;AACH,qBAAa,kBAAkB;;IAE3B,QAAQ,CAAC,OAAO,EAAE,wBAAwB,CAAC;gBAE/B,IAAI,EAAE,UAAU;IAK5B,oGAAoG;IAC9F,IAAI,IAAI,OAAO,CAAC,oBAAoB,CAAC;IAI3C;;;;;;OAMG;IACG,MAAM,CAAC,KAAK,EAAE,oBAAoB,GAAG,OAAO,CAAC,gBAAgB,CAAC;CAOvE"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
const WORKSPACES_PATH = "/v1/workspaces";
|
|
2
|
+
function keysPath(workspaceId) {
|
|
3
|
+
return `${WORKSPACES_PATH}/${encodeURIComponent(workspaceId)}/api-keys`;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* The keys of ONE workspace (`/v1/workspaces/{id}/api-keys*`), managed with an ACCOUNT
|
|
7
|
+
* key and the user's LIVE role there. Not a member (or the workspace does not exist /
|
|
8
|
+
* is archived) → 403 `WORKSPACE_MEMBERSHIP_REQUIRED`.
|
|
9
|
+
*/
|
|
10
|
+
export class WorkspaceApiKeysResource {
|
|
11
|
+
#http;
|
|
12
|
+
constructor(http) {
|
|
13
|
+
this.#http = http;
|
|
14
|
+
}
|
|
15
|
+
/** `GET /v1/workspaces/{id}/api-keys` — the workspace's keys, MASKED (ADMIN and up). */
|
|
16
|
+
async list(workspaceId) {
|
|
17
|
+
return this.#http.requestJson({ method: "GET", path: keysPath(workspaceId) });
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* `POST /v1/workspaces/{id}/api-keys` → HTTP 201 — mints a NAMED `ps_workspace_`
|
|
21
|
+
* key (never the primary); `apiKey.key` is shown ONCE. ADMIN and up. 409
|
|
22
|
+
* `WORKSPACE_KEY_LIMIT_REACHED` (with `limit`) at the cap. Not idempotent.
|
|
23
|
+
*/
|
|
24
|
+
async create(workspaceId, input) {
|
|
25
|
+
return this.#http.requestJson({
|
|
26
|
+
method: "POST",
|
|
27
|
+
path: keysPath(workspaceId),
|
|
28
|
+
body: { name: input.name },
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* `DELETE /v1/workspaces/{id}/api-keys/{keyId}` — revokes a NAMED key (effective on
|
|
33
|
+
* the next request). The primary key is 409 `PRIMARY_KEY_NOT_REVOCABLE` (rotate it
|
|
34
|
+
* with `POST /v1/api-keys/regenerate` and `workspaceId` instead); an unknown id is 404 `API_KEY_NOT_FOUND`.
|
|
35
|
+
*/
|
|
36
|
+
async revoke(workspaceId, keyId) {
|
|
37
|
+
return this.#http.requestJson({
|
|
38
|
+
method: "DELETE",
|
|
39
|
+
path: `${keysPath(workspaceId)}/${encodeURIComponent(keyId)}`,
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Account-level workspaces (`/v1/workspaces*`). ⛔ ACCOUNT key (`ps_account_`) ONLY —
|
|
45
|
+
* any other credential (workspace key, number key, OAuth token) is 403
|
|
46
|
+
* `ACCOUNT_KEY_REQUIRED`. `workspaceId` is not needed here: these routes name their
|
|
47
|
+
* workspace in the path. Every method resolves to the response body untouched.
|
|
48
|
+
*/
|
|
49
|
+
export class WorkspacesResource {
|
|
50
|
+
#http;
|
|
51
|
+
apiKeys;
|
|
52
|
+
constructor(http) {
|
|
53
|
+
this.#http = http;
|
|
54
|
+
this.apiKeys = new WorkspaceApiKeysResource(http);
|
|
55
|
+
}
|
|
56
|
+
/** `GET /v1/workspaces` — the workspaces the key's user is an ACTIVE member of, with their role. */
|
|
57
|
+
async list() {
|
|
58
|
+
return this.#http.requestJson({ method: "GET", path: WORKSPACES_PATH });
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* `POST /v1/workspaces` → HTTP 201 — a workspace owned by the key's user, with its
|
|
62
|
+
* PRIMARY key in `apiKey` (shown once; `null` if minting failed — then mint one with
|
|
63
|
+
* `apiKeys.create()`, do NOT create the workspace again). 409
|
|
64
|
+
* `WORKSPACE_LIMIT_REACHED` (with `limit`) at the user's ceiling. Not idempotent,
|
|
65
|
+
* never retried by the SDK.
|
|
66
|
+
*/
|
|
67
|
+
async create(input) {
|
|
68
|
+
return this.#http.requestJson({
|
|
69
|
+
method: "POST",
|
|
70
|
+
path: WORKSPACES_PATH,
|
|
71
|
+
body: { name: input.name },
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=workspaces.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspaces.js","sourceRoot":"","sources":["../../src/resources/workspaces.ts"],"names":[],"mappings":"AAWA,MAAM,eAAe,GAAG,gBAAgB,CAAC;AAEzC,SAAS,QAAQ,CAAC,WAAmB;IACjC,OAAO,GAAG,eAAe,IAAI,kBAAkB,CAAC,WAAW,CAAC,WAAW,CAAC;AAC5E,CAAC;AAED;;;;GAIG;AACH,MAAM,OAAO,wBAAwB;IACxB,KAAK,CAAa;IAE3B,YAAY,IAAgB;QACxB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACtB,CAAC;IAED,wFAAwF;IACxF,KAAK,CAAC,IAAI,CAAC,WAAmB;QAC1B,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,CAAmB,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;IACpG,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,MAAM,CAAC,WAAmB,EAAE,KAA8B;QAC5D,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,CAAsB;YAC/C,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,QAAQ,CAAC,WAAW,CAAC;YAC3B,IAAI,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE;SAC7B,CAAC,CAAC;IACP,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,MAAM,CAAC,WAAmB,EAAE,KAAa;QAC3C,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,CAAsB;YAC/C,MAAM,EAAE,QAAQ;YAChB,IAAI,EAAE,GAAG,QAAQ,CAAC,WAAW,CAAC,IAAI,kBAAkB,CAAC,KAAK,CAAC,EAAE;SAChE,CAAC,CAAC;IACP,CAAC;CACJ;AAED;;;;;GAKG;AACH,MAAM,OAAO,kBAAkB;IAClB,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,oGAAoG;IACpG,KAAK,CAAC,IAAI;QACN,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,CAAuB,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,eAAe,EAAE,CAAC,CAAC;IAClG,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,MAAM,CAAC,KAA2B;QACpC,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,CAAmB;YAC5C,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,eAAe;YACrB,IAAI,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE;SAC7B,CAAC,CAAC;IACP,CAAC;CACJ"}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { PhoneLineWebhookEventName, WorkspaceWebhookEventName } from "./webhooks/types.js";
|
|
1
2
|
export type MessageStatus = "QUEUED" | "SENT" | "DELIVERED" | "FAILED" | "READ" | "CANCELED";
|
|
2
3
|
/**
|
|
3
4
|
* The API accepts BOTH spellings. The uppercase set is the current one (aligned with
|
|
@@ -156,6 +157,16 @@ export type SendMessageInput = {
|
|
|
156
157
|
marketingOptions?: MarketingOptions;
|
|
157
158
|
media?: string;
|
|
158
159
|
mediaType?: "image" | "video" | "document" | "audio" | "voice" | "sticker";
|
|
160
|
+
/**
|
|
161
|
+
* File name the recipient sees for a DOCUMENT (e.g. `"invoice-1234.pdf"`). 1–240
|
|
162
|
+
* characters after trimming; `/` and `\` become `_`.
|
|
163
|
+
*
|
|
164
|
+
* Valid on a direct media send (`media` + `mediaType: "document"`, no `templateId`/`text`)
|
|
165
|
+
* and on a `templateId` send whose approved template has a DOCUMENT header — with or
|
|
166
|
+
* without a per-send `media`; if `mediaType` is given it must be `"document"`. On any
|
|
167
|
+
* other header type the API answers 422 `MEDIA_FILENAME_REQUIRES_DOCUMENT_HEADER`.
|
|
168
|
+
*/
|
|
169
|
+
mediaFilename?: string;
|
|
159
170
|
buttons?: Button[];
|
|
160
171
|
/**
|
|
161
172
|
* Interactive single-select list. Mutually exclusive with `templateId`, `carousel`,
|
|
@@ -1729,16 +1740,170 @@ export type EmbedSessionResult = {
|
|
|
1729
1740
|
expiresAt: string;
|
|
1730
1741
|
};
|
|
1731
1742
|
export type CheckoutPurpose = "wallet_topup" | "add_card";
|
|
1743
|
+
/** How a `wallet_topup` is paid. `"card"` (the default) is a hosted Stripe page. */
|
|
1744
|
+
export type CheckoutMethod = "card" | "pix";
|
|
1732
1745
|
export type CheckoutInput = {
|
|
1733
1746
|
purpose: CheckoutPurpose;
|
|
1734
1747
|
/** Required on `wallet_topup`, in the account's currency. */
|
|
1735
1748
|
amount?: number;
|
|
1749
|
+
/**
|
|
1750
|
+
* `wallet_topup` only (on `add_card` it is 400 `FIELD_NOT_APPLICABLE`). `"pix"` is
|
|
1751
|
+
* for BRL workspaces only (400 `PIX_NOT_ELIGIBLE` otherwise) and answers the Pix
|
|
1752
|
+
* code instead of a URL. Sent only when given.
|
|
1753
|
+
*/
|
|
1754
|
+
method?: CheckoutMethod;
|
|
1755
|
+
/** Card checkouts only: with `method: "pix"` it is 400 `FIELD_NOT_APPLICABLE`. */
|
|
1736
1756
|
successUrl?: string;
|
|
1757
|
+
/** Card checkouts only: with `method: "pix"` it is 400 `FIELD_NOT_APPLICABLE`. */
|
|
1737
1758
|
cancelUrl?: string;
|
|
1738
1759
|
};
|
|
1739
|
-
/**
|
|
1740
|
-
export type
|
|
1760
|
+
/** `add_card`: the hosted page that saves a card. Nothing is charged. */
|
|
1761
|
+
export type AddCardCheckoutResult = {
|
|
1762
|
+
url: string;
|
|
1763
|
+
purpose: "add_card";
|
|
1764
|
+
};
|
|
1765
|
+
/** `wallet_topup` by card: the hosted payment page and the PENDING order behind it. */
|
|
1766
|
+
export type CardTopupCheckoutResult = {
|
|
1741
1767
|
url: string;
|
|
1768
|
+
purpose: "wallet_topup";
|
|
1769
|
+
method: "card";
|
|
1770
|
+
/** Poll it with `billing.getTopup(orderId)`. */
|
|
1771
|
+
orderId: string;
|
|
1772
|
+
amount: number;
|
|
1773
|
+
currency: string;
|
|
1774
|
+
};
|
|
1775
|
+
/** The Pix charge to show the payer. */
|
|
1776
|
+
export type PixCharge = {
|
|
1777
|
+
transactionId: string;
|
|
1778
|
+
/** The Pix "copia e cola" code. */
|
|
1779
|
+
copyPaste: string;
|
|
1780
|
+
/** The QR code image (as the PSP returns it), or `null` when it sent none. */
|
|
1781
|
+
qrCode: string | null;
|
|
1782
|
+
/** ISO-8601. After it the order reads `expired`. */
|
|
1783
|
+
expiresAt: string;
|
|
1784
|
+
};
|
|
1785
|
+
/** `wallet_topup` by Pix (BRL only): no URL — show `pix.copyPaste` / `pix.qrCode`. */
|
|
1786
|
+
export type PixTopupCheckoutResult = {
|
|
1787
|
+
purpose: "wallet_topup";
|
|
1788
|
+
method: "pix";
|
|
1789
|
+
/** Poll it with `billing.getTopup(orderId)`. */
|
|
1790
|
+
orderId: string;
|
|
1791
|
+
status: "pending";
|
|
1792
|
+
amount: number;
|
|
1793
|
+
currency: string;
|
|
1794
|
+
pix: PixCharge;
|
|
1795
|
+
};
|
|
1796
|
+
/** Nothing is charged until a human completes the payment (page or Pix). */
|
|
1797
|
+
export type CheckoutResult = AddCardCheckoutResult | CardTopupCheckoutResult | PixTopupCheckoutResult;
|
|
1798
|
+
/** `pending` → `paid`, or `expired` (Pix past `expiresAt`) / `failed`. */
|
|
1799
|
+
export type WalletTopupStatus = "pending" | "paid" | "expired" | "failed";
|
|
1800
|
+
/** One wallet top-up order, from `billing.getTopup()`. */
|
|
1801
|
+
export type WalletTopup = {
|
|
1802
|
+
id: string;
|
|
1803
|
+
status: WalletTopupStatus;
|
|
1804
|
+
amount: number;
|
|
1805
|
+
currency: string;
|
|
1806
|
+
method: "pix" | "card";
|
|
1807
|
+
/** e.g. `"STRIPE"`, `"PAGUE_DEV"`. */
|
|
1808
|
+
provider: string;
|
|
1809
|
+
/** ISO-8601. */
|
|
1810
|
+
createdAt: string;
|
|
1811
|
+
/** ISO-8601; `null` until paid. */
|
|
1812
|
+
paidAt: string | null;
|
|
1813
|
+
/** ISO-8601 for a Pix; `null` for a card order. */
|
|
1814
|
+
expiresAt: string | null;
|
|
1815
|
+
};
|
|
1816
|
+
/** Body of `GET /v1/billing/topups/{id}`. */
|
|
1817
|
+
export type WalletTopupResponse = {
|
|
1818
|
+
topup: WalletTopup;
|
|
1819
|
+
};
|
|
1820
|
+
/**
|
|
1821
|
+
* Body of `POST /v1/billing/card/setup-intent` — mount Stripe's Payment Element with
|
|
1822
|
+
* `clientSecret` and `publishableKey`, then call `stripe.confirmSetup(...)` in the
|
|
1823
|
+
* browser. ⛔ `clientSecret` lets its holder confirm the intent: never log it.
|
|
1824
|
+
*/
|
|
1825
|
+
export type CardSetupIntent = {
|
|
1826
|
+
clientSecret: string;
|
|
1827
|
+
/** `seti_…` — pass it to `billing.syncCardSetupIntent()`. */
|
|
1828
|
+
setupIntentId: string;
|
|
1829
|
+
publishableKey: string;
|
|
1830
|
+
};
|
|
1831
|
+
export type SavedCard = {
|
|
1832
|
+
brand: string;
|
|
1833
|
+
last4: string;
|
|
1834
|
+
expMonth: number;
|
|
1835
|
+
expYear: number;
|
|
1836
|
+
};
|
|
1837
|
+
/** Body of `POST /v1/billing/card/setup-intent/{id}/sync`. */
|
|
1838
|
+
export type CardSetupIntentSync = {
|
|
1839
|
+
setupIntentId: string;
|
|
1840
|
+
/** Stripe's SetupIntent status (`succeeded`, `processing`, `requires_action`, …). */
|
|
1841
|
+
status: string;
|
|
1842
|
+
/** `true` once the card is the workspace's saved card. */
|
|
1843
|
+
saved: boolean;
|
|
1844
|
+
/** The saved card; `null` while `saved` is `false`. */
|
|
1845
|
+
card: SavedCard | null;
|
|
1846
|
+
};
|
|
1847
|
+
/**
|
|
1848
|
+
* Body of `POST /v1/billing/payment-intents`. Exactly these fields — any other one is
|
|
1849
|
+
* 400 `UNKNOWN_FIELDS`.
|
|
1850
|
+
*/
|
|
1851
|
+
export type CreatePaymentIntentInput = {
|
|
1852
|
+
/** The only purpose today. */
|
|
1853
|
+
purpose: "wallet_topup";
|
|
1854
|
+
/** Major units, in the workspace's currency; positive. Rounded to cents by the server. */
|
|
1855
|
+
amount: number;
|
|
1856
|
+
/** `true` also makes the card the workspace's saved card. */
|
|
1857
|
+
saveCard?: boolean;
|
|
1858
|
+
};
|
|
1859
|
+
export type CreatePaymentIntentOptions = {
|
|
1860
|
+
/**
|
|
1861
|
+
* Sent as the `Idempotency-Key` header (optional; ≤255 chars, no control characters,
|
|
1862
|
+
* else 400 `IDEMPOTENCY_KEY_INVALID`). Within 24 h a retry with the same key and the
|
|
1863
|
+
* same body gets the SAME order and PaymentIntent back (`replayed: true`) and creates
|
|
1864
|
+
* nothing; the same key with a different body is 409 `IDEMPOTENCY_KEY_REUSED`, and
|
|
1865
|
+
* while the first call is still running 409 `IDEMPOTENCY_KEY_IN_USE`.
|
|
1866
|
+
*/
|
|
1867
|
+
idempotencyKey?: string;
|
|
1868
|
+
};
|
|
1869
|
+
/**
|
|
1870
|
+
* The PaymentIntent of a transparent top-up. ⛔ `clientSecret` lets its holder confirm
|
|
1871
|
+
* the payment: never log it.
|
|
1872
|
+
*/
|
|
1873
|
+
export type WalletTopupPaymentIntent = {
|
|
1874
|
+
clientSecret: string;
|
|
1875
|
+
/** `pi_…` — pass it to `billing.syncPaymentIntent()`. */
|
|
1876
|
+
paymentIntentId: string;
|
|
1877
|
+
/** The PENDING top-up order (`billing.getTopup(orderId)`). */
|
|
1878
|
+
orderId: string;
|
|
1879
|
+
amount: number;
|
|
1880
|
+
currency: string;
|
|
1881
|
+
publishableKey: string;
|
|
1882
|
+
};
|
|
1883
|
+
/**
|
|
1884
|
+
* What `billing.createPaymentIntent()` resolves to. `paymentIntent` is the response
|
|
1885
|
+
* body untouched; `replayed` is `true` only when the server answered from the
|
|
1886
|
+
* idempotency record (`Idempotent-Replayed: true`).
|
|
1887
|
+
*/
|
|
1888
|
+
export type CreatePaymentIntentResult = {
|
|
1889
|
+
paymentIntent: WalletTopupPaymentIntent;
|
|
1890
|
+
replayed: boolean;
|
|
1891
|
+
};
|
|
1892
|
+
/** Body of `POST /v1/billing/payment-intents/{id}/sync`. */
|
|
1893
|
+
export type PaymentIntentSync = {
|
|
1894
|
+
paymentIntentId: string;
|
|
1895
|
+
/** Stripe's PaymentIntent status. */
|
|
1896
|
+
status: string;
|
|
1897
|
+
orderId: string | null;
|
|
1898
|
+
/** `COMPLETED`, `PENDING`, `FAILED` (Stripe canceled it) or `UNCHANGED`. */
|
|
1899
|
+
orderStatus: string;
|
|
1900
|
+
amount: number;
|
|
1901
|
+
currency: string;
|
|
1902
|
+
/** `true` only on the call that credited the wallet; replays read `false`. */
|
|
1903
|
+
credited: boolean;
|
|
1904
|
+
/** Wallet balance after the credit; `null` when nothing was credited by this call. */
|
|
1905
|
+
balance: number | null;
|
|
1906
|
+
cardSaved: boolean;
|
|
1742
1907
|
};
|
|
1743
1908
|
export type ExtraNumbersPreview = {
|
|
1744
1909
|
quantity: number;
|
|
@@ -2316,4 +2481,238 @@ export type ActivationAudio = {
|
|
|
2316
2481
|
/** The `filename` of `Content-Disposition`, or `null` when absent. */
|
|
2317
2482
|
fileName: string | null;
|
|
2318
2483
|
};
|
|
2484
|
+
/**
|
|
2485
|
+
* What a phone-line webhook subscribes to: an event name (`"phone_line.code_received"`,
|
|
2486
|
+
* …) or `"*"`, which inside THIS registry means every phone-line event — including
|
|
2487
|
+
* ones added after the webhook was created. Typed as `string` on the way back so an
|
|
2488
|
+
* event newer than this SDK does not break your code.
|
|
2489
|
+
*/
|
|
2490
|
+
export type PhoneLineWebhookSubscription = PhoneLineWebhookEventName | "*";
|
|
2491
|
+
/** A phone-line webhook as every read returns it. The signing `secret` is NEVER here. */
|
|
2492
|
+
export type PhoneLineWebhook = {
|
|
2493
|
+
id: string;
|
|
2494
|
+
/** Defaults to the URL's hostname when created without one. */
|
|
2495
|
+
name: string;
|
|
2496
|
+
url: string;
|
|
2497
|
+
events: string[];
|
|
2498
|
+
/** `false` = paused: nothing is delivered. */
|
|
2499
|
+
active: boolean;
|
|
2500
|
+
/** ISO-8601 of the last delivery attempt; `null` before the first. */
|
|
2501
|
+
lastDeliveryAt: string | null;
|
|
2502
|
+
/** HTTP status your endpoint answered on the last attempt; `null` when none. */
|
|
2503
|
+
lastStatusCode: number | null;
|
|
2504
|
+
/** ISO-8601. */
|
|
2505
|
+
createdAt: string;
|
|
2506
|
+
};
|
|
2507
|
+
/**
|
|
2508
|
+
* The webhook returned by `create()` — the ONLY response that carries `secret`
|
|
2509
|
+
* (`plwh_…`). Store it right away: nothing shows it again and there is no rotation.
|
|
2510
|
+
*/
|
|
2511
|
+
export type CreatedPhoneLineWebhook = Pick<PhoneLineWebhook, "id" | "name" | "url" | "events" | "active" | "createdAt"> & {
|
|
2512
|
+
/** `plwh_…` — the HMAC-SHA256 key of `x-pilot-status-signature`. */
|
|
2513
|
+
secret: string;
|
|
2514
|
+
};
|
|
2515
|
+
/** Body of `GET /v1/phone-lines/webhooks`. */
|
|
2516
|
+
export type PhoneLineWebhookList = {
|
|
2517
|
+
/** Oldest first. */
|
|
2518
|
+
webhooks: PhoneLineWebhook[];
|
|
2519
|
+
/** The event catalogue the server accepts (without `"*"`). */
|
|
2520
|
+
events: string[];
|
|
2521
|
+
};
|
|
2522
|
+
/** Body of `GET`/`PATCH /v1/phone-lines/webhooks/{id}`. */
|
|
2523
|
+
export type PhoneLineWebhookResponse = {
|
|
2524
|
+
webhook: PhoneLineWebhook;
|
|
2525
|
+
};
|
|
2526
|
+
/** Body of `POST /v1/phone-lines/webhooks` (HTTP 201). */
|
|
2527
|
+
export type CreatePhoneLineWebhookResponse = {
|
|
2528
|
+
webhook: CreatedPhoneLineWebhook;
|
|
2529
|
+
};
|
|
2530
|
+
/**
|
|
2531
|
+
* Body of `POST /v1/phone-lines/webhooks`. Exactly these fields — any other one is
|
|
2532
|
+
* 400 `UNKNOWN_FIELDS`, a wrong type (or `null`) is 400 `INVALID_FIELD_TYPE`.
|
|
2533
|
+
*/
|
|
2534
|
+
export type CreatePhoneLineWebhookInput = {
|
|
2535
|
+
/** `https` and public; an internal or private destination is 400 `WEBHOOK_URL_REFUSED`. */
|
|
2536
|
+
url: string;
|
|
2537
|
+
/** Non-empty. `["*"]` = every phone-line event. */
|
|
2538
|
+
events: PhoneLineWebhookSubscription[];
|
|
2539
|
+
/** Up to 100 characters. Blank or omitted = the URL's hostname. */
|
|
2540
|
+
name?: string;
|
|
2541
|
+
};
|
|
2542
|
+
/** Body of `PATCH /v1/phone-lines/webhooks/{id}`. An omitted field is left as it is. */
|
|
2543
|
+
export type UpdatePhoneLineWebhookInput = {
|
|
2544
|
+
name?: string;
|
|
2545
|
+
/** Checked against internal destinations only when it CHANGES. */
|
|
2546
|
+
url?: string;
|
|
2547
|
+
/** REPLACES the whole list (non-empty). */
|
|
2548
|
+
events?: PhoneLineWebhookSubscription[];
|
|
2549
|
+
/** `false` pauses the webhook; `true` resumes it. */
|
|
2550
|
+
active?: boolean;
|
|
2551
|
+
};
|
|
2552
|
+
/** Body of `DELETE /v1/phone-lines/webhooks/{id}`. */
|
|
2553
|
+
export type PhoneLineWebhookDeleteResult = {
|
|
2554
|
+
ok: true;
|
|
2555
|
+
};
|
|
2556
|
+
export type PhoneLineWebhookDeliveryStatus = "PENDING" | "DELIVERED" | "FAILED";
|
|
2557
|
+
/** One delivery in the list — its outcome, NEVER its payload. */
|
|
2558
|
+
export type PhoneLineWebhookDelivery = {
|
|
2559
|
+
id: string;
|
|
2560
|
+
event: string;
|
|
2561
|
+
status: PhoneLineWebhookDeliveryStatus;
|
|
2562
|
+
/** Attempts made so far (up to 6, with exponential backoff). */
|
|
2563
|
+
attempts: number;
|
|
2564
|
+
/** HTTP status of the last attempt; `null` when it got no HTTP answer. */
|
|
2565
|
+
responseStatus: number | null;
|
|
2566
|
+
/** Why the last attempt failed; `null` when it did not. */
|
|
2567
|
+
lastError: string | null;
|
|
2568
|
+
/** ISO-8601. */
|
|
2569
|
+
createdAt: string;
|
|
2570
|
+
/** ISO-8601; `null` until delivered. */
|
|
2571
|
+
deliveredAt: string | null;
|
|
2572
|
+
};
|
|
2573
|
+
/** One delivery in full, from `getDelivery()`. */
|
|
2574
|
+
export type PhoneLineWebhookDeliveryDetail = PhoneLineWebhookDelivery & {
|
|
2575
|
+
/** How long the last attempt took; `null` when it made no request. */
|
|
2576
|
+
durationMs: number | null;
|
|
2577
|
+
/** Your endpoint's answer to the last attempt, at most 1000 characters; `null` when none. */
|
|
2578
|
+
responseBody: string | null;
|
|
2579
|
+
/**
|
|
2580
|
+
* The EXACT body that was POSTed and signed, as a JSON string — check it against
|
|
2581
|
+
* the `x-pilot-status-signature` your endpoint received with `verifyWebhookSignature`.
|
|
2582
|
+
* ⛔ A `phone_line.code_received` payload carries the activation code: treat it as a
|
|
2583
|
+
* credential.
|
|
2584
|
+
*/
|
|
2585
|
+
payload: string;
|
|
2586
|
+
};
|
|
2587
|
+
/** Query of `GET /v1/phone-lines/webhooks/{id}/deliveries`. */
|
|
2588
|
+
export type ListPhoneLineWebhookDeliveriesParams = {
|
|
2589
|
+
/** Integer 1–200 (server default 50); anything else is 400 `INVALID_LIMIT`. */
|
|
2590
|
+
limit?: number;
|
|
2591
|
+
};
|
|
2592
|
+
/** Body of `GET /v1/phone-lines/webhooks/{id}/deliveries` — newest first. */
|
|
2593
|
+
export type PhoneLineWebhookDeliveryList = {
|
|
2594
|
+
deliveries: PhoneLineWebhookDelivery[];
|
|
2595
|
+
};
|
|
2596
|
+
/** Body of `GET /v1/phone-lines/webhooks/{id}/deliveries/{deliveryId}`. */
|
|
2597
|
+
export type PhoneLineWebhookDeliveryResponse = {
|
|
2598
|
+
delivery: PhoneLineWebhookDeliveryDetail;
|
|
2599
|
+
};
|
|
2600
|
+
/**
|
|
2601
|
+
* What a workspace webhook subscribes to. `"*"` = every PHONE-LINE event only —
|
|
2602
|
+
* `wallet.topup_paid` is opt-in and must be named (e.g. `["*", "wallet.topup_paid"]`).
|
|
2603
|
+
*/
|
|
2604
|
+
export type WorkspaceWebhookSubscription = WorkspaceWebhookEventName | "*";
|
|
2605
|
+
/** A workspace webhook — the same row as a phone-line webhook. Never the secret. */
|
|
2606
|
+
export type WorkspaceWebhook = PhoneLineWebhook;
|
|
2607
|
+
/** Returned by `create()` only, with the `plwh_` `secret`. */
|
|
2608
|
+
export type CreatedWorkspaceWebhook = CreatedPhoneLineWebhook;
|
|
2609
|
+
/** Body of `GET /v1/workspace/webhooks`: every webhook of the workspace and the catalogue. */
|
|
2610
|
+
export type WorkspaceWebhookList = PhoneLineWebhookList;
|
|
2611
|
+
export type WorkspaceWebhookResponse = PhoneLineWebhookResponse;
|
|
2612
|
+
export type CreateWorkspaceWebhookResponse = CreatePhoneLineWebhookResponse;
|
|
2613
|
+
export type WorkspaceWebhookDeleteResult = PhoneLineWebhookDeleteResult;
|
|
2614
|
+
export type WorkspaceWebhookDelivery = PhoneLineWebhookDelivery;
|
|
2615
|
+
export type WorkspaceWebhookDeliveryDetail = PhoneLineWebhookDeliveryDetail;
|
|
2616
|
+
export type ListWorkspaceWebhookDeliveriesParams = ListPhoneLineWebhookDeliveriesParams;
|
|
2617
|
+
export type WorkspaceWebhookDeliveryList = PhoneLineWebhookDeliveryList;
|
|
2618
|
+
export type WorkspaceWebhookDeliveryResponse = PhoneLineWebhookDeliveryResponse;
|
|
2619
|
+
/** Body of `POST /v1/workspace/webhooks`. Any other field is 400 `UNKNOWN_FIELDS`. */
|
|
2620
|
+
export type CreateWorkspaceWebhookInput = {
|
|
2621
|
+
/** `https` and public; an internal or private destination is 400 `WEBHOOK_URL_REFUSED`. */
|
|
2622
|
+
url: string;
|
|
2623
|
+
/** Non-empty. `"*"` = every phone-line event; `wallet.topup_paid` must be named. */
|
|
2624
|
+
events: WorkspaceWebhookSubscription[];
|
|
2625
|
+
/** Up to 100 characters. Blank or omitted = the URL's hostname. */
|
|
2626
|
+
name?: string;
|
|
2627
|
+
};
|
|
2628
|
+
/** Body of `PATCH /v1/workspace/webhooks/{id}`. An omitted field is left as it is. */
|
|
2629
|
+
export type UpdateWorkspaceWebhookInput = {
|
|
2630
|
+
name?: string;
|
|
2631
|
+
url?: string;
|
|
2632
|
+
/** REPLACES the whole list (non-empty). */
|
|
2633
|
+
events?: WorkspaceWebhookSubscription[];
|
|
2634
|
+
/** `false` pauses the webhook; `true` resumes it. */
|
|
2635
|
+
active?: boolean;
|
|
2636
|
+
};
|
|
2637
|
+
/** One workspace the account key's user is an ACTIVE member of. */
|
|
2638
|
+
export type AccountWorkspace = {
|
|
2639
|
+
id: string;
|
|
2640
|
+
name: string;
|
|
2641
|
+
/** The user's role in it. */
|
|
2642
|
+
role: WorkspaceRole;
|
|
2643
|
+
/** The current plan (`FREE` when there is no subscription). */
|
|
2644
|
+
plan: string;
|
|
2645
|
+
/** ISO-8601. */
|
|
2646
|
+
createdAt: string;
|
|
2647
|
+
};
|
|
2648
|
+
/** Body of `GET /v1/workspaces` — archived workspaces are left out. */
|
|
2649
|
+
export type AccountWorkspaceList = {
|
|
2650
|
+
data: AccountWorkspace[];
|
|
2651
|
+
};
|
|
2652
|
+
/** Body of `POST /v1/workspaces`. Any other field is 400 `UNKNOWN_FIELDS`. */
|
|
2653
|
+
export type CreateWorkspaceInput = {
|
|
2654
|
+
/** Required (400 `NAME_REQUIRED`); too long is 400 `NAME_TOO_LONG` with `maxLength`. */
|
|
2655
|
+
name: string;
|
|
2656
|
+
};
|
|
2657
|
+
/**
|
|
2658
|
+
* A freshly minted workspace key — the ONLY response that carries `key` in the clear.
|
|
2659
|
+
* Store it right away.
|
|
2660
|
+
*/
|
|
2661
|
+
export type MintedWorkspaceKey = {
|
|
2662
|
+
id: string;
|
|
2663
|
+
name: string;
|
|
2664
|
+
/** `ps_workspace_…`. ⛔ A secret: never log it. */
|
|
2665
|
+
key: string;
|
|
2666
|
+
prefix: string;
|
|
2667
|
+
last4: string | null;
|
|
2668
|
+
isPrimary: boolean;
|
|
2669
|
+
/** ISO-8601. */
|
|
2670
|
+
createdAt: string;
|
|
2671
|
+
};
|
|
2672
|
+
/**
|
|
2673
|
+
* Body of `POST /v1/workspaces` (HTTP 201). `apiKey` is the new workspace's PRIMARY
|
|
2674
|
+
* key, shown once — or `null` when the workspace was created but minting failed
|
|
2675
|
+
* (mint one with `workspaces.apiKeys.create()`; do NOT create the workspace again).
|
|
2676
|
+
*/
|
|
2677
|
+
export type CreatedWorkspace = {
|
|
2678
|
+
id: string;
|
|
2679
|
+
name: string;
|
|
2680
|
+
/** `FREE`, or `PAY_AS_YOU_GO` for a reseller's workspace. */
|
|
2681
|
+
plan: string;
|
|
2682
|
+
/** ISO-8601. */
|
|
2683
|
+
createdAt: string;
|
|
2684
|
+
role: "OWNER";
|
|
2685
|
+
apiKey: MintedWorkspaceKey | null;
|
|
2686
|
+
};
|
|
2687
|
+
/** A workspace key, masked — never the key itself. */
|
|
2688
|
+
export type WorkspaceKey = {
|
|
2689
|
+
id: string;
|
|
2690
|
+
name: string;
|
|
2691
|
+
prefix: string;
|
|
2692
|
+
last4: string | null;
|
|
2693
|
+
isPrimary: boolean;
|
|
2694
|
+
/** ISO-8601. */
|
|
2695
|
+
createdAt: string;
|
|
2696
|
+
/** ISO-8601; `null` when never used. */
|
|
2697
|
+
lastUsedAt: string | null;
|
|
2698
|
+
};
|
|
2699
|
+
/** Body of `GET /v1/workspaces/{id}/api-keys`. */
|
|
2700
|
+
export type WorkspaceKeyList = {
|
|
2701
|
+
data: WorkspaceKey[];
|
|
2702
|
+
};
|
|
2703
|
+
/** Body of `POST /v1/workspaces/{id}/api-keys`. Any other field is 400 `UNKNOWN_FIELDS`. */
|
|
2704
|
+
export type CreateWorkspaceKeyInput = {
|
|
2705
|
+
/** Required (400 `NAME_REQUIRED`); too long is 400 `NAME_TOO_LONG`. */
|
|
2706
|
+
name: string;
|
|
2707
|
+
};
|
|
2708
|
+
/** Body of `POST /v1/workspaces/{id}/api-keys` (HTTP 201) — a NAMED key, never the primary. */
|
|
2709
|
+
export type CreatedWorkspaceKey = {
|
|
2710
|
+
apiKey: MintedWorkspaceKey;
|
|
2711
|
+
};
|
|
2712
|
+
/** Body of `DELETE /v1/workspaces/{id}/api-keys/{keyId}`. */
|
|
2713
|
+
export type RevokedWorkspaceKey = {
|
|
2714
|
+
id: string;
|
|
2715
|
+
/** ISO-8601. The key stops working on the next request. */
|
|
2716
|
+
revokedAt: string;
|
|
2717
|
+
};
|
|
2319
2718
|
//# sourceMappingURL=types.d.ts.map
|