@pilot-status/sdk 0.26.0 → 0.28.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 +50 -0
- package/README.md +141 -5
- package/dist/client.d.ts +3 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +4 -0
- package/dist/client.js.map +1 -1
- package/dist/errors.d.ts +10 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +10 -0
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/resources/ads.d.ts +23 -12
- package/dist/resources/ads.d.ts.map +1 -1
- package/dist/resources/ads.js +28 -12
- package/dist/resources/ads.js.map +1 -1
- package/dist/resources/api-keys.d.ts +52 -4
- package/dist/resources/api-keys.d.ts.map +1 -1
- package/dist/resources/api-keys.js +68 -3
- package/dist/resources/api-keys.js.map +1 -1
- package/dist/resources/flows.d.ts +56 -1
- package/dist/resources/flows.d.ts.map +1 -1
- package/dist/resources/flows.js +93 -0
- package/dist/resources/flows.js.map +1 -1
- package/dist/resources/knowledge.d.ts +14 -0
- package/dist/resources/knowledge.d.ts.map +1 -0
- package/dist/resources/knowledge.js +27 -0
- package/dist/resources/knowledge.js.map +1 -0
- package/dist/resources/lead-pages.d.ts +7 -3
- package/dist/resources/lead-pages.d.ts.map +1 -1
- package/dist/resources/lead-pages.js +9 -2
- package/dist/resources/lead-pages.js.map +1 -1
- package/dist/resources/messages.d.ts +23 -1
- package/dist/resources/messages.d.ts.map +1 -1
- package/dist/resources/messages.js +34 -0
- package/dist/resources/messages.js.map +1 -1
- package/dist/resources/numbers.d.ts +36 -1
- package/dist/resources/numbers.d.ts.map +1 -1
- package/dist/resources/numbers.js +67 -0
- package/dist/resources/numbers.js.map +1 -1
- package/dist/resources/phone-lines.d.ts +67 -1
- package/dist/resources/phone-lines.d.ts.map +1 -1
- package/dist/resources/phone-lines.js +116 -0
- package/dist/resources/phone-lines.js.map +1 -1
- package/dist/resources/workspace-webhooks.d.ts +17 -1
- package/dist/resources/workspace-webhooks.d.ts.map +1 -1
- package/dist/resources/workspace-webhooks.js +21 -0
- package/dist/resources/workspace-webhooks.js.map +1 -1
- package/dist/resources/workspace.d.ts +47 -9
- package/dist/resources/workspace.d.ts.map +1 -1
- package/dist/resources/workspace.js +81 -8
- package/dist/resources/workspace.js.map +1 -1
- package/dist/types.d.ts +352 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/user-agent.d.ts +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
|
@@ -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;AAE7C,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,KAAK,EACR,4BAA4B,EAC5B,sBAAsB,EACtB,eAAe,EACf,eAAe,EACf,mBAAmB,EACnB,qBAAqB,EACrB,iBAAiB,EACjB,yBAAyB,EACzB,gCAAgC,EACnC,MAAM,aAAa,CAAC;AAErB
|
|
1
|
+
{"version":3,"file":"workspace.d.ts","sourceRoot":"","sources":["../../src/resources/workspace.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,KAAK,EACR,0BAA0B,EAC1B,2BAA2B,EAC3B,4BAA4B,EAC5B,2BAA2B,EAC3B,4BAA4B,EAC5B,2BAA2B,EAC3B,0BAA0B,EAC1B,4BAA4B,EAC5B,sBAAsB,EACtB,eAAe,EACf,eAAe,EACf,mBAAmB,EACnB,qBAAqB,EACrB,qBAAqB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KG;IACG,cAAc,CAAC,KAAK,EAAE,4BAA4B,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAYrF;;;;;;;;;;;OAWG;IACG,OAAO,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,sBAAsB,CAAC;IAQnE;;;;;;;;OAQG;IACG,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,gCAAgC,CAAC;CAOpF"}
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import { compact } from "../internal.js";
|
|
2
2
|
import { WorkspaceWebhooksResource } from "./workspace-webhooks.js";
|
|
3
3
|
/**
|
|
4
|
-
* Workspace members
|
|
4
|
+
* Workspace members.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* `403 MACHINE_CREDENTIAL_CANNOT_MANAGE_MEMBERS` 100% of the time — a trap, not a
|
|
12
|
-
* feature. Use the dashboard or an OAuth connector.
|
|
6
|
+
* Reads accept any tenant-scoped credential. The WRITES (invite, resend, role change,
|
|
7
|
+
* number scope, removal) need a USER on the wire: an ACCOUNT key (`ps_account_…` +
|
|
8
|
+
* `workspaceId`) or an OAuth token. Every classic `ps_` key (workspace or number) is
|
|
9
|
+
* refused with 403 `MACHINE_CREDENTIAL_CANNOT_MANAGE_MEMBERS` — with no user, any bearer
|
|
10
|
+
* of any key could invite an ADMIN. The user's LIVE role then decides (403 otherwise).
|
|
13
11
|
*/
|
|
14
12
|
export class WorkspaceMembersResource {
|
|
15
13
|
#http;
|
|
@@ -48,6 +46,81 @@ export class WorkspaceMembersResource {
|
|
|
48
46
|
path: "/v1/workspace/members",
|
|
49
47
|
});
|
|
50
48
|
}
|
|
49
|
+
/**
|
|
50
|
+
* `POST /v1/workspace/members` — invites (or re-invites) an email → 201, or 200 with
|
|
51
|
+
* `resent: true` for a pending invite. Needs `members:invite`; `role` defaults to
|
|
52
|
+
* `AGENT` and must be one the caller may assign (403 `ROLE_NOT_ASSIGNABLE`).
|
|
53
|
+
*
|
|
54
|
+
* `sendEmail: false` sends no email and returns `inviteUrl` ONCE — only its hash is
|
|
55
|
+
* stored, so a lost link is recovered with {@link resend}. Rate-limited per
|
|
56
|
+
* workspace, per invitee and per IP (429). Account key or OAuth only.
|
|
57
|
+
*/
|
|
58
|
+
async invite(input) {
|
|
59
|
+
return this.#http.requestJson({
|
|
60
|
+
method: "POST",
|
|
61
|
+
path: "/v1/workspace/members",
|
|
62
|
+
body: compact({
|
|
63
|
+
email: input.email,
|
|
64
|
+
role: input.role,
|
|
65
|
+
allowedNumberIds: input.allowedNumberIds,
|
|
66
|
+
sendEmail: input.sendEmail,
|
|
67
|
+
}),
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* `PATCH /v1/workspace/members/{id}` — changes the role (and optionally the number
|
|
72
|
+
* allowlist). `members:role:update` is OWNER-only; `OWNER` itself is never
|
|
73
|
+
* assignable here (use `client.workspace.transferOwnership`). An invalid role is 400
|
|
74
|
+
* `ROLE_NOT_ASSIGNABLE`. `id` is the MEMBERSHIP id. Account key or OAuth only.
|
|
75
|
+
*/
|
|
76
|
+
async update(id, input) {
|
|
77
|
+
return this.#http.requestJson({
|
|
78
|
+
method: "PATCH",
|
|
79
|
+
path: `/v1/workspace/members/${encodeURIComponent(id)}`,
|
|
80
|
+
body: compact({ role: input.role, allowedNumberIds: input.allowedNumberIds }),
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* `DELETE /v1/workspace/members/{id}` — removes an ACTIVE member or revokes a PENDING
|
|
85
|
+
* invite (`members:remove`).
|
|
86
|
+
*
|
|
87
|
+
* ⚠️ When the member created API keys that still work, the call STOPS with 409
|
|
88
|
+
* `MEMBER_HAS_API_KEYS` (and the list): repeat it with `apiKeyAction: "revoke"` or
|
|
89
|
+
* `"keep"`. Revoking by omission would take a production integration down.
|
|
90
|
+
* Account key or OAuth only.
|
|
91
|
+
*/
|
|
92
|
+
async remove(id, options) {
|
|
93
|
+
return this.#http.requestJson({
|
|
94
|
+
method: "DELETE",
|
|
95
|
+
path: `/v1/workspace/members/${encodeURIComponent(id)}`,
|
|
96
|
+
query: compact({ apiKeyAction: options?.apiKeyAction }),
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* `POST /v1/workspace/members/{id}/resend` — re-issues a PENDING invite
|
|
101
|
+
* (`members:invite`). ALWAYS rotates the token: the previous link dies on the spot.
|
|
102
|
+
* With `sendEmail: false` the new `inviteUrl` comes back once instead of an email.
|
|
103
|
+
* Account key or OAuth only.
|
|
104
|
+
*/
|
|
105
|
+
async resend(id, options) {
|
|
106
|
+
return this.#http.requestJson({
|
|
107
|
+
method: "POST",
|
|
108
|
+
path: `/v1/workspace/members/${encodeURIComponent(id)}/resend`,
|
|
109
|
+
body: compact({ sendEmail: options?.sendEmail }),
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* `PATCH /v1/workspace/members/{id}/numbers` — which numbers an AGENT/ANALYST sees
|
|
114
|
+
* (`members:scope:update`, ADMIN and up). `[]` = ALL numbers, including ones
|
|
115
|
+
* connected later. The list is required (never defaulted). Account key or OAuth only.
|
|
116
|
+
*/
|
|
117
|
+
async updateNumbers(id, allowedNumberIds) {
|
|
118
|
+
return this.#http.requestJson({
|
|
119
|
+
method: "PATCH",
|
|
120
|
+
path: `/v1/workspace/members/${encodeURIComponent(id)}/numbers`,
|
|
121
|
+
body: { allowedNumberIds },
|
|
122
|
+
});
|
|
123
|
+
}
|
|
51
124
|
}
|
|
52
125
|
/**
|
|
53
126
|
* The credential's workspace (account): identity, members, settings and the two
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workspace.js","sourceRoot":"","sources":["../../src/resources/workspace.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAA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WAAW,EAAE;SACxB,CAAC,CAAC;IACP,CAAC;IAED;;;;;;;;OAQG;IACH,KAAK,CAAC,iBAAiB,CAAC,KAAa;QACjC,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,CAAmC;YAC5D,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,kCAAkC;YACxC,IAAI,EAAE,EAAE,KAAK,EAAE;SAClB,CAAC,CAAC;IACP,CAAC;CACJ"}
|
package/dist/types.d.ts
CHANGED
|
@@ -153,6 +153,7 @@ export type SendMessageInput = {
|
|
|
153
153
|
groupId?: string;
|
|
154
154
|
newsletterId?: string;
|
|
155
155
|
variables?: Record<string, string>;
|
|
156
|
+
/** @deprecated Labels were removed from Pilot Status (2026-11-27). The API accepts and ignores this field; it will be dropped in the next major. */
|
|
156
157
|
labels?: string[];
|
|
157
158
|
deliverAt?: string;
|
|
158
159
|
deliverUntil?: string;
|
|
@@ -362,6 +363,35 @@ export type ApiKeyListResult = ApiKeyListItem[] | NumberApiKeyReveal[];
|
|
|
362
363
|
* The new usable key returned by `POST /v1/api-keys` (tenant-scoped) when
|
|
363
364
|
* regenerating the default key of one number. The raw `key` is shown only once.
|
|
364
365
|
*/
|
|
366
|
+
/** One key of a WhatsApp number (`GET /v1/numbers/{numberId}/api-keys`). */
|
|
367
|
+
export type NumberApiKey = {
|
|
368
|
+
id: string;
|
|
369
|
+
name: string;
|
|
370
|
+
prefix: string;
|
|
371
|
+
last4: string;
|
|
372
|
+
isPrimary: boolean;
|
|
373
|
+
createdAt: string;
|
|
374
|
+
lastUsedAt: string | null;
|
|
375
|
+
};
|
|
376
|
+
export type NumberApiKeyList = {
|
|
377
|
+
data: NumberApiKey[];
|
|
378
|
+
};
|
|
379
|
+
/** A named number key just created — `key` is the raw value, shown ONCE. */
|
|
380
|
+
export type CreatedNumberApiKey = {
|
|
381
|
+
apiKey: {
|
|
382
|
+
id: string;
|
|
383
|
+
name: string;
|
|
384
|
+
key: string;
|
|
385
|
+
prefix: string;
|
|
386
|
+
last4: string;
|
|
387
|
+
isPrimary: false;
|
|
388
|
+
createdAt: string;
|
|
389
|
+
};
|
|
390
|
+
};
|
|
391
|
+
export type RevokedNumberApiKey = {
|
|
392
|
+
revoked: true;
|
|
393
|
+
id: string;
|
|
394
|
+
};
|
|
365
395
|
export type RegeneratedNumberKey = {
|
|
366
396
|
numberId: string;
|
|
367
397
|
keyId: string;
|
|
@@ -1508,6 +1538,8 @@ export type LinkedAdAccount = {
|
|
|
1508
1538
|
/** `act_<digits>`. */
|
|
1509
1539
|
adAccountId: string;
|
|
1510
1540
|
adAccountName: string | null;
|
|
1541
|
+
/** The official number the account is linked to; `null` on a legacy workspace-wide link. */
|
|
1542
|
+
whatsappNumberId?: string | null;
|
|
1511
1543
|
/** ISO-8601. */
|
|
1512
1544
|
linkedAt: string;
|
|
1513
1545
|
/**
|
|
@@ -1539,13 +1571,29 @@ export type AdAccountListResult = {
|
|
|
1539
1571
|
/** `"ok"`, `"unavailable"` (Meta lookup failed) or `"not_configured"`. */
|
|
1540
1572
|
sharingLookup: "ok" | "unavailable" | "not_configured";
|
|
1541
1573
|
};
|
|
1574
|
+
export type AdAccountListParams = {
|
|
1575
|
+
/** Narrow to one number (must be inside the key's scope and official). */
|
|
1576
|
+
whatsappNumberId?: string;
|
|
1577
|
+
};
|
|
1578
|
+
export type AdAccountLinkOptions = {
|
|
1579
|
+
/**
|
|
1580
|
+
* The official number the account is linked to. REQUIRED with an account-wide
|
|
1581
|
+
* (workspace) key; a number-scoped key defaults to its own number.
|
|
1582
|
+
*/
|
|
1583
|
+
whatsappNumberId?: string;
|
|
1584
|
+
};
|
|
1542
1585
|
export type AdAccountLinkResult = {
|
|
1543
1586
|
link: {
|
|
1544
1587
|
adAccountId: string;
|
|
1545
1588
|
adAccountName: string | null;
|
|
1589
|
+
whatsappNumberId?: string | null;
|
|
1546
1590
|
linkedAt: string;
|
|
1547
1591
|
};
|
|
1548
1592
|
};
|
|
1593
|
+
export type LeadPageListParams = {
|
|
1594
|
+
/** Narrow to one number (must be inside the key's scope and official). */
|
|
1595
|
+
whatsappNumberId?: string;
|
|
1596
|
+
};
|
|
1549
1597
|
export type AdAccountUnlinkResult = {
|
|
1550
1598
|
unlinked: true;
|
|
1551
1599
|
adAccountId: string;
|
|
@@ -1747,6 +1795,31 @@ export type ServiceWindowResult = {
|
|
|
1747
1795
|
/** `lastInboundAt` + 24h. */
|
|
1748
1796
|
expiresAt: string | null;
|
|
1749
1797
|
};
|
|
1798
|
+
/** `doc` = API documentation, `blog` = blog article, `page` = public site page. */
|
|
1799
|
+
export type KnowledgeType = "doc" | "blog" | "page";
|
|
1800
|
+
export type KnowledgeLanguage = "pt-BR" | "en" | "es";
|
|
1801
|
+
export type KnowledgeSearchParams = {
|
|
1802
|
+
/** What to look for: a question, keywords or an error code (1–500 chars). */
|
|
1803
|
+
query: string;
|
|
1804
|
+
type?: KnowledgeType;
|
|
1805
|
+
language?: KnowledgeLanguage;
|
|
1806
|
+
/** 1–20, default 5. */
|
|
1807
|
+
limit?: number;
|
|
1808
|
+
};
|
|
1809
|
+
export type KnowledgeSearchHit = {
|
|
1810
|
+
title: string;
|
|
1811
|
+
/** Public URL of the page (with a `#anchor` for a docs section). */
|
|
1812
|
+
url: string;
|
|
1813
|
+
type: KnowledgeType;
|
|
1814
|
+
language: KnowledgeLanguage;
|
|
1815
|
+
/** YYYY-MM-DD, or `null` when the source has no date. */
|
|
1816
|
+
updated: string | null;
|
|
1817
|
+
snippet: string;
|
|
1818
|
+
score: number;
|
|
1819
|
+
};
|
|
1820
|
+
export type KnowledgeSearchResult = {
|
|
1821
|
+
results: KnowledgeSearchHit[];
|
|
1822
|
+
};
|
|
1750
1823
|
export type MetaPricingParams = {
|
|
1751
1824
|
/** ISO-3166 alpha-2 (BR, GB…), `NAM`, or a regional bucket (AFR, APAC, LATAM…). */
|
|
1752
1825
|
market?: string;
|
|
@@ -2809,6 +2882,8 @@ export type WorkspaceWebhookDeliveryDetail = PhoneLineWebhookDeliveryDetail;
|
|
|
2809
2882
|
export type ListWorkspaceWebhookDeliveriesParams = ListPhoneLineWebhookDeliveriesParams;
|
|
2810
2883
|
export type WorkspaceWebhookDeliveryList = PhoneLineWebhookDeliveryList;
|
|
2811
2884
|
export type WorkspaceWebhookDeliveryResponse = PhoneLineWebhookDeliveryResponse;
|
|
2885
|
+
/** `POST /v1/workspace/webhooks/{id}/rotate-secret` — the NEW `plwh_` secret, in clear, once. */
|
|
2886
|
+
export type WorkspaceWebhookRotateSecretResult = WebhookRotateSecretResult;
|
|
2812
2887
|
/** Body of `POST /v1/workspace/webhooks`. Any other field is 400 `UNKNOWN_FIELDS`. */
|
|
2813
2888
|
export type CreateWorkspaceWebhookInput = {
|
|
2814
2889
|
/** `https` and public; an internal or private destination is 400 `WEBHOOK_URL_REFUSED`. */
|
|
@@ -3015,4 +3090,281 @@ export type RevokeStoryResult = {
|
|
|
3015
3090
|
revokedAt?: string;
|
|
3016
3091
|
canceledAt?: string;
|
|
3017
3092
|
};
|
|
3093
|
+
/** `GET /v1/messages/unread/counts` query. */
|
|
3094
|
+
export type UnreadCountsParams = {
|
|
3095
|
+
/**
|
|
3096
|
+
* Numbers to count (max 100), sent comma-separated. Omitted → every number inside
|
|
3097
|
+
* the credential's reach. A number outside it is 403 `NUMBER_NOT_IN_GRANT`; one that
|
|
3098
|
+
* is not a live number of the workspace is 404 `NUMBER_NOT_FOUND`.
|
|
3099
|
+
*/
|
|
3100
|
+
whatsappNumberIds?: string[];
|
|
3101
|
+
};
|
|
3102
|
+
export type UnreadCountByNumber = {
|
|
3103
|
+
whatsappNumberId: string;
|
|
3104
|
+
number: string;
|
|
3105
|
+
displayName: string | null;
|
|
3106
|
+
/** The same `total` `GET /v1/messages/unread` answers for that number. */
|
|
3107
|
+
total: number;
|
|
3108
|
+
};
|
|
3109
|
+
export type UnreadCountsResult = {
|
|
3110
|
+
/** In the order asked for; otherwise oldest number first. */
|
|
3111
|
+
byNumber: UnreadCountByNumber[];
|
|
3112
|
+
total: number;
|
|
3113
|
+
};
|
|
3114
|
+
/** `POST /v1/messages/{id}/resend` → 202: the new send, plus the id of the original. */
|
|
3115
|
+
export type ResendMessageResult = SendMessageAccepted & {
|
|
3116
|
+
originalMessageId: string;
|
|
3117
|
+
};
|
|
3118
|
+
/** `POST /v1/api-keys/regenerate` → 201. `key` is shown ONCE. */
|
|
3119
|
+
export type RegeneratedApiKey = {
|
|
3120
|
+
id: string;
|
|
3121
|
+
name: string | null;
|
|
3122
|
+
key: string;
|
|
3123
|
+
keyPrefix: string;
|
|
3124
|
+
keyLast4: string;
|
|
3125
|
+
scope: "tenant" | "number";
|
|
3126
|
+
whatsappNumberId: string | null;
|
|
3127
|
+
createdAt: string;
|
|
3128
|
+
};
|
|
3129
|
+
export type InviteWorkspaceMemberInput = {
|
|
3130
|
+
email: string;
|
|
3131
|
+
/** Defaults to `AGENT`. Must be a role the caller can assign (403 `ROLE_NOT_ASSIGNABLE`). */
|
|
3132
|
+
role?: WorkspaceRole;
|
|
3133
|
+
/** Empty/omitted = every number. */
|
|
3134
|
+
allowedNumberIds?: string[];
|
|
3135
|
+
/** `false` → no email is sent and `inviteUrl` comes back ONCE. Default `true`. */
|
|
3136
|
+
sendEmail?: boolean;
|
|
3137
|
+
};
|
|
3138
|
+
/** `POST /v1/workspace/members` → 201 (new) or 200 (`resent: true`, re-invite). */
|
|
3139
|
+
export type InviteWorkspaceMemberResult = {
|
|
3140
|
+
member: WorkspaceMember;
|
|
3141
|
+
resent: boolean;
|
|
3142
|
+
emailSent: boolean;
|
|
3143
|
+
/** Only when `sendEmail: false`. Not re-derivable: lose it and call `resend()`. */
|
|
3144
|
+
inviteUrl?: string;
|
|
3145
|
+
};
|
|
3146
|
+
export type ResendWorkspaceInviteOptions = {
|
|
3147
|
+
/** `false` → no email; the NEW `inviteUrl` comes back once. Default `true`. */
|
|
3148
|
+
sendEmail?: boolean;
|
|
3149
|
+
};
|
|
3150
|
+
/** `POST /v1/workspace/members/{id}/resend`. */
|
|
3151
|
+
export type ResendWorkspaceInviteResult = {
|
|
3152
|
+
member: WorkspaceMember;
|
|
3153
|
+
emailSent: boolean;
|
|
3154
|
+
/** Only when `sendEmail: false`. */
|
|
3155
|
+
inviteUrl?: string;
|
|
3156
|
+
};
|
|
3157
|
+
export type UpdateWorkspaceMemberInput = {
|
|
3158
|
+
role: WorkspaceRole;
|
|
3159
|
+
allowedNumberIds?: string[];
|
|
3160
|
+
};
|
|
3161
|
+
export type WorkspaceMemberResult = {
|
|
3162
|
+
member: WorkspaceMember;
|
|
3163
|
+
};
|
|
3164
|
+
export type RemoveWorkspaceMemberOptions = {
|
|
3165
|
+
/**
|
|
3166
|
+
* What to do with the API keys the member created that still work. Without it a
|
|
3167
|
+
* member with such keys is 409 `MEMBER_HAS_API_KEYS` (with the list).
|
|
3168
|
+
*/
|
|
3169
|
+
apiKeyAction?: "revoke" | "keep";
|
|
3170
|
+
};
|
|
3171
|
+
export type RemoveWorkspaceMemberResult = {
|
|
3172
|
+
removed: true;
|
|
3173
|
+
email: string;
|
|
3174
|
+
apiKeysRevoked: number;
|
|
3175
|
+
apiKeysReassigned: number;
|
|
3176
|
+
oauthTokensRevoked: number;
|
|
3177
|
+
};
|
|
3178
|
+
export type FlowPreviewInput = {
|
|
3179
|
+
/** `true` → Meta mints a NEW link and the previous one stops working. */
|
|
3180
|
+
invalidate?: boolean;
|
|
3181
|
+
};
|
|
3182
|
+
/** `POST /v1/flows/{id}/preview`. ⛔ `previewUrl` needs NO login: treat it as a secret. */
|
|
3183
|
+
export type FlowPreviewResult = {
|
|
3184
|
+
flowId: string;
|
|
3185
|
+
previewUrl: string;
|
|
3186
|
+
expiresAt: string | null;
|
|
3187
|
+
invalidated: boolean;
|
|
3188
|
+
requiresLogin: false;
|
|
3189
|
+
warning: string;
|
|
3190
|
+
warningEN: string;
|
|
3191
|
+
};
|
|
3192
|
+
export type FlowTrace = {
|
|
3193
|
+
id: string;
|
|
3194
|
+
action: string | null;
|
|
3195
|
+
screen: string | null;
|
|
3196
|
+
outcome: string;
|
|
3197
|
+
httpStatus: number | null;
|
|
3198
|
+
durationMs: number | null;
|
|
3199
|
+
failureReason: string | null;
|
|
3200
|
+
/** Withheld (placeholder) on a `RELAY_ONLY` number. */
|
|
3201
|
+
forwardedBody: string | null;
|
|
3202
|
+
customerBody: string | null;
|
|
3203
|
+
createdAt: string;
|
|
3204
|
+
};
|
|
3205
|
+
/** `GET /v1/flows/{id}/traces` — one capped, recent tail (not paginated). */
|
|
3206
|
+
export type FlowTraceList = {
|
|
3207
|
+
traces: FlowTrace[];
|
|
3208
|
+
/** Only on an empty list: traces are kept for a short window (24 h by default). */
|
|
3209
|
+
notice?: string;
|
|
3210
|
+
};
|
|
3211
|
+
export type FlowEndpointWarning = "FLOW_ENDPOINT_NO_DESTINATION" | "FLOW_ENDPOINT_NUMBER_HAS_NO_KEY" | "FLOW_ENDPOINT_KEY_NOT_AT_META" | "FLOW_ENDPOINT_META_URI_UNKNOWN" | "FLOW_ENDPOINT_META_DRIFT" | (string & {});
|
|
3212
|
+
/** `GET /v1/flows/{id}/endpoint` — the Flow's `data_exchange` wiring. */
|
|
3213
|
+
export type FlowEndpointState = {
|
|
3214
|
+
flowId: string;
|
|
3215
|
+
/** YOUR webhook, where we forward the decrypted exchange. */
|
|
3216
|
+
url: string | null;
|
|
3217
|
+
hasSecret: boolean;
|
|
3218
|
+
/** OUR proxy URL for this Flow (embeds a credential token). */
|
|
3219
|
+
endpointUri: string | null;
|
|
3220
|
+
/** Where Meta currently points the Flow. */
|
|
3221
|
+
metaEndpointUri: string | null;
|
|
3222
|
+
drift: boolean;
|
|
3223
|
+
numberHasKey: boolean;
|
|
3224
|
+
numberKeyUploadedAt: string | null;
|
|
3225
|
+
warnings: FlowEndpointWarning[];
|
|
3226
|
+
};
|
|
3227
|
+
export type SetFlowEndpointInput = {
|
|
3228
|
+
/** Required: an `https://` URL, or `null` EXPLICITLY to remove the destination. */
|
|
3229
|
+
url: string | null;
|
|
3230
|
+
/** `true` → a new HMAC signing secret is generated (the old one stops verifying). */
|
|
3231
|
+
rotateSecret?: boolean;
|
|
3232
|
+
};
|
|
3233
|
+
/** `PUT /v1/flows/{id}/endpoint`. `secret` is the signing secret, when disclosed. */
|
|
3234
|
+
export type SetFlowEndpointResult = FlowEndpointState & {
|
|
3235
|
+
secret: string | null;
|
|
3236
|
+
secretWithheld?: true;
|
|
3237
|
+
secretWithheldReason?: string;
|
|
3238
|
+
secretWithheldCode?: string;
|
|
3239
|
+
};
|
|
3240
|
+
export type RegisterFlowEndpointInput = {
|
|
3241
|
+
/** Required to overwrite an `endpoint_uri` Meta already has that is not ours. */
|
|
3242
|
+
confirmOverwrite?: boolean;
|
|
3243
|
+
};
|
|
3244
|
+
/** `POST /v1/flows/{id}/endpoint` — registers our proxy URL as the Flow's endpoint on Meta. */
|
|
3245
|
+
export type RegisterFlowEndpointResult = FlowEndpointState & {
|
|
3246
|
+
republished: boolean;
|
|
3247
|
+
finalStatus: string | null;
|
|
3248
|
+
};
|
|
3249
|
+
/** `POST /v1/flows/meta/sync`. */
|
|
3250
|
+
export type FlowMetaSyncResult = {
|
|
3251
|
+
created: number;
|
|
3252
|
+
updated: number;
|
|
3253
|
+
seen: number;
|
|
3254
|
+
truncated: boolean;
|
|
3255
|
+
};
|
|
3256
|
+
/** `GET /v1/flows/{id}/json`. */
|
|
3257
|
+
export type FlowJsonDocument = {
|
|
3258
|
+
id: string;
|
|
3259
|
+
flowJson: string;
|
|
3260
|
+
};
|
|
3261
|
+
export type PhoneLineStatus = "ACTIVE" | "PAYMENT_PENDING" | "SUSPENDED" | "RETURNED" | "CANCELED" | (string & {});
|
|
3262
|
+
export type PhoneLine = {
|
|
3263
|
+
id: string;
|
|
3264
|
+
/** Never blank: the formatted number when the line has no name. */
|
|
3265
|
+
name: string;
|
|
3266
|
+
/** E.164 digits without `+`. */
|
|
3267
|
+
number: string;
|
|
3268
|
+
display: string;
|
|
3269
|
+
ddd: string;
|
|
3270
|
+
status: PhoneLineStatus;
|
|
3271
|
+
/** Price of the NEXT renewal. */
|
|
3272
|
+
price: number;
|
|
3273
|
+
currency: string;
|
|
3274
|
+
purchasedAt: string;
|
|
3275
|
+
currentPeriodEnd: string;
|
|
3276
|
+
cancelAtPeriodEnd: boolean;
|
|
3277
|
+
paymentPendingSince: string | null;
|
|
3278
|
+
suspendedAt: string | null;
|
|
3279
|
+
returnedAt: string | null;
|
|
3280
|
+
canceledAt: string | null;
|
|
3281
|
+
activationCount: number;
|
|
3282
|
+
/** What paying the unpaid line now charges; `null` when nothing is owed. */
|
|
3283
|
+
amountDue: number | null;
|
|
3284
|
+
};
|
|
3285
|
+
export type ListPhoneLinesParams = {
|
|
3286
|
+
/** `true` adds the finished lines (RETURNED, CANCELED). */
|
|
3287
|
+
includeClosed?: boolean;
|
|
3288
|
+
};
|
|
3289
|
+
export type PhoneLineList = {
|
|
3290
|
+
lines: PhoneLine[];
|
|
3291
|
+
};
|
|
3292
|
+
export type PhoneLineResponse = {
|
|
3293
|
+
line: PhoneLine;
|
|
3294
|
+
};
|
|
3295
|
+
export type AvailablePhoneLines = {
|
|
3296
|
+
ddd: string;
|
|
3297
|
+
totalAvailable: number;
|
|
3298
|
+
/** `number` is exactly what `buy()` takes. */
|
|
3299
|
+
numbers: {
|
|
3300
|
+
number: string;
|
|
3301
|
+
display: string;
|
|
3302
|
+
}[];
|
|
3303
|
+
/** What ONE new line costs this workspace per month. */
|
|
3304
|
+
price: number;
|
|
3305
|
+
currency: "BRL" | "USD" | (string & {});
|
|
3306
|
+
};
|
|
3307
|
+
export type BuyPhoneLinesOptions = {
|
|
3308
|
+
/** REQUIRED: sent as `Idempotency-Key`. Reuse the same key on retry. */
|
|
3309
|
+
idempotencyKey: string;
|
|
3310
|
+
};
|
|
3311
|
+
export type PhoneLinePurchaseOutcome = {
|
|
3312
|
+
number: string;
|
|
3313
|
+
ok: true;
|
|
3314
|
+
lineId: string;
|
|
3315
|
+
} | {
|
|
3316
|
+
number: string;
|
|
3317
|
+
ok: false;
|
|
3318
|
+
code: string;
|
|
3319
|
+
error: string;
|
|
3320
|
+
};
|
|
3321
|
+
/** HTTP 200 even when some (or all) numbers failed: read each `results[i].ok`. */
|
|
3322
|
+
export type PhoneLinePurchaseResult = {
|
|
3323
|
+
results: PhoneLinePurchaseOutcome[];
|
|
3324
|
+
};
|
|
3325
|
+
export type PhoneLineActivationStatus = "WAITING" | "CAPTURED" | "TRANSCRIBED" | "TIMED_OUT" | "FAILED" | (string & {});
|
|
3326
|
+
export type PhoneLineActivation = {
|
|
3327
|
+
id: string;
|
|
3328
|
+
lineId: string;
|
|
3329
|
+
status: PhoneLineActivationStatus;
|
|
3330
|
+
requestedAt: string;
|
|
3331
|
+
pollDeadline: string;
|
|
3332
|
+
/** ⛔ A credential once TRANSCRIBED. */
|
|
3333
|
+
code: string | null;
|
|
3334
|
+
capturedAt: string | null;
|
|
3335
|
+
transcribedAt: string | null;
|
|
3336
|
+
failureReason: string | null;
|
|
3337
|
+
hasAudio: boolean;
|
|
3338
|
+
};
|
|
3339
|
+
export type ListPhoneLineActivationsParams = {
|
|
3340
|
+
/** 1..100, default 20. */
|
|
3341
|
+
limit?: number;
|
|
3342
|
+
};
|
|
3343
|
+
export type PhoneLineActivationList = {
|
|
3344
|
+
activations: PhoneLineActivation[];
|
|
3345
|
+
};
|
|
3346
|
+
export type PhoneLineActivationResponse = {
|
|
3347
|
+
activation: PhoneLineActivation;
|
|
3348
|
+
};
|
|
3349
|
+
/** `POST|DELETE /v1/numbers/{id}/contacts/{phone}/block`. */
|
|
3350
|
+
export type ContactBlockResult = {
|
|
3351
|
+
success: true;
|
|
3352
|
+
numberId: string;
|
|
3353
|
+
provider: string;
|
|
3354
|
+
phone: string | null;
|
|
3355
|
+
jid: string | null;
|
|
3356
|
+
blocked: boolean;
|
|
3357
|
+
occurredAt: string;
|
|
3358
|
+
};
|
|
3359
|
+
/** `POST|DELETE /v1/numbers/{id}/chats/{jid}/archive`. */
|
|
3360
|
+
export type ChatArchiveResult = {
|
|
3361
|
+
success: true;
|
|
3362
|
+
numberId: string;
|
|
3363
|
+
provider: string;
|
|
3364
|
+
jid: string;
|
|
3365
|
+
phone: string | null;
|
|
3366
|
+
isGroup: boolean;
|
|
3367
|
+
archived: boolean;
|
|
3368
|
+
occurredAt: string;
|
|
3369
|
+
};
|
|
3018
3370
|
//# sourceMappingURL=types.d.ts.map
|