@pilot-status/sdk 0.2.0 → 0.4.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.
Files changed (47) hide show
  1. package/README.md +86 -14
  2. package/dist/client.d.ts +6 -0
  3. package/dist/client.d.ts.map +1 -1
  4. package/dist/client.js +10 -1
  5. package/dist/client.js.map +1 -1
  6. package/dist/http.d.ts +1 -1
  7. package/dist/http.d.ts.map +1 -1
  8. package/dist/index.d.ts +3 -2
  9. package/dist/index.d.ts.map +1 -1
  10. package/dist/index.js +1 -0
  11. package/dist/index.js.map +1 -1
  12. package/dist/resources/api-keys.d.ts +19 -2
  13. package/dist/resources/api-keys.d.ts.map +1 -1
  14. package/dist/resources/api-keys.js +19 -11
  15. package/dist/resources/api-keys.js.map +1 -1
  16. package/dist/resources/calls.d.ts +72 -0
  17. package/dist/resources/calls.d.ts.map +1 -0
  18. package/dist/resources/calls.js +151 -0
  19. package/dist/resources/calls.js.map +1 -0
  20. package/dist/resources/media.d.ts +8 -0
  21. package/dist/resources/media.d.ts.map +1 -0
  22. package/dist/resources/media.js +14 -0
  23. package/dist/resources/media.js.map +1 -0
  24. package/dist/resources/messages.d.ts +2 -2
  25. package/dist/resources/messages.d.ts.map +1 -1
  26. package/dist/resources/messages.js +23 -10
  27. package/dist/resources/messages.js.map +1 -1
  28. package/dist/resources/numbers.d.ts +10 -8
  29. package/dist/resources/numbers.d.ts.map +1 -1
  30. package/dist/resources/numbers.js +11 -14
  31. package/dist/resources/numbers.js.map +1 -1
  32. package/dist/resources/remote-pairing.d.ts +10 -0
  33. package/dist/resources/remote-pairing.d.ts.map +1 -0
  34. package/dist/resources/remote-pairing.js +25 -0
  35. package/dist/resources/remote-pairing.js.map +1 -0
  36. package/dist/types.d.ts +201 -48
  37. package/dist/types.d.ts.map +1 -1
  38. package/dist/types.js +10 -1
  39. package/dist/types.js.map +1 -1
  40. package/dist/webhooks/parse.d.ts.map +1 -1
  41. package/dist/webhooks/parse.js +121 -130
  42. package/dist/webhooks/parse.js.map +1 -1
  43. package/dist/webhooks/types.d.ts +169 -140
  44. package/dist/webhooks/types.d.ts.map +1 -1
  45. package/dist/webhooks/types.js +7 -0
  46. package/dist/webhooks/types.js.map +1 -1
  47. package/package.json +4 -3
package/README.md CHANGED
@@ -47,12 +47,15 @@ const projects = await client.projects.list();
47
47
  ### API keys
48
48
 
49
49
  ```ts
50
- const key = await client.apiKeys.create({
51
- name: "Backend Key",
52
- retentionDays: 30,
53
- });
50
+ // Regenerate the default key of one number (tenant-scoped). The new usable key
51
+ // is returned once — there is no "create another key" concept.
52
+ const regenerated = await client.apiKeys.regenerateNumber("wn_1");
53
+ console.log(regenerated.key); // shown only once
54
54
 
55
55
  const keys = await client.apiKeys.list();
56
+ // With a number-scoped key this returns that number's masked keys (`ApiKeyListItem[]`).
57
+ // With a tenant-scoped key it returns a lean per-number list (`NumberApiKeyReveal[]`):
58
+ // { numberId, number, displayName, keyId, keyLast4, key, revealable } — `key` is the real usable value when `revealable` is true.
56
59
  ```
57
60
 
58
61
  ### Numbers (WhatsApp)
@@ -70,23 +73,91 @@ const refreshed = await client.numbers.connect(created.instance.id);
70
73
  const status = await client.numbers.getStatus(created.instance.id);
71
74
  ```
72
75
 
73
- ## Opt-in check (destination authorization)
74
-
75
- In LIVE, sending may require opt-in when using the Pilot Status WhatsApp number. You can check whether a destination is already authorized for your project:
76
+ ## Analytics
76
77
 
77
78
  ```ts
78
- const optIn = await client.messages.checkOptIn("+5511999999");
79
+ const stats = await client.analytics.getDashboardStats({ tz: "America/Sao_Paulo" });
80
+ console.log(stats.totalSent, stats.failureRate);
81
+ ```
82
+
83
+ ## Calls (WhatsApp Business Calling)
84
+
85
+ Voice calls over the `/v1/calls*` endpoints, on **two kinds of numbers**:
86
+
87
+ - **Meta Cloud API numbers** — signaling-only: `initiate`/`accept` carry the
88
+ SDP (RFC 8866) produced by your WebRTC client, and audio flows directly
89
+ between the browser and WhatsApp. Settings/permissions/`preAccept` are
90
+ Meta-only.
91
+ - **Web (Pilot Status / unofficial) numbers** — call media is handled
92
+ server-side, so there is **no SDP** (omit `sdp` on `initiate`/`accept`).
93
+ No call permission is required before `initiate` and there is **no Meta
94
+ per-minute billing**. Extra media controls: `play` (stream an audio file
95
+ into the call) and `realtimeSession` (full-duplex PCM16 WebSocket).
96
+
97
+ Numbers on any other provider get `400 FEATURE_NOT_SUPPORTED`. `callId`
98
+ arguments accept the Pilot Status id (`call_...`) **or** the provider call id
99
+ (Meta `wacid...` / Evolution GO CallID).
100
+
101
+ > Billing: on Meta numbers, business-initiated calls (BIC) are billed by
102
+ > **Meta directly on your WABA** — per minute, in 6-second pulses, only when
103
+ > answered; user-initiated calls (UIC) are free. Calls on web numbers have no
104
+ > Meta billing at all. Pilot Status does not charge for calls.
105
+ >
106
+ > Web numbers are unofficial (QR-paired) WhatsApp sessions — call quality and
107
+ > availability depend on the paired device/session, and heavy automated
108
+ > calling carries the usual unofficial-number ban risk.
79
109
 
80
- if (!optIn.authorized) {
81
- throw new Error(`Missing opt-in: ${optIn.reason}`);
110
+ ```ts
111
+ // 1. Permission first (required before calling a user)
112
+ const perm = await client.calls.getPermissions("+5511999999999");
113
+ if (perm.permission.status === "no_permission") {
114
+ await client.calls.requestPermission({
115
+ to: "+5511999999999",
116
+ text: "May we call you about your order?",
117
+ });
118
+ // the user's reply arrives as the call.permission_updated webhook
82
119
  }
120
+
121
+ // 2. Start a business-initiated call (sdp = offer from your WebRTC client)
122
+ const call = await client.calls.initiate({
123
+ to: "+5511999999999",
124
+ sdp: offerSdp,
125
+ bizOpaqueCallbackData: "order-42",
126
+ });
127
+
128
+ // 3. Answer an inbound call (after the call.ringing webhook)
129
+ const inbound = await client.calls.get("wacid.ABGG...", { includeSdp: true });
130
+ // feed inbound.sdpOffer to your WebRTC client, produce the answer, then:
131
+ await client.calls.accept(inbound.id, answerSdp);
132
+
133
+ // Other controls
134
+ await client.calls.reject("wacid.ABGG...");
135
+ await client.calls.terminate("wacid.ABGG...");
136
+
137
+ // History + settings (settings are Meta-only)
138
+ const { calls } = await client.calls.list({ limit: 25 });
139
+ const settings = await client.calls.getSettings();
140
+ await client.calls.updateSettings({ status: "ENABLED" });
83
141
  ```
84
142
 
85
- ## Analytics
143
+ On a **web (Pilot Status) number** the same flow needs no SDP and no
144
+ permission step, and you get server-side media controls:
86
145
 
87
146
  ```ts
88
- const stats = await client.analytics.getDashboardStats({ tz: "America/Sao_Paulo" });
89
- console.log(stats.totalSent, stats.failureRate);
147
+ // Start a call (no sdp, no permission step)
148
+ const call = await client.calls.initiate({ to: "+5511999999999" });
149
+
150
+ // Answer an inbound call (after the call.ringing webhook) — no sdp
151
+ await client.calls.accept(call.id);
152
+
153
+ // Stream an audio file into the active call (.mp3/.wav/.opus by URL;
154
+ // queued and played on connect when the call is not active yet)
155
+ await client.calls.play(call.id, "https://cdn.example.com/ivr-greeting.mp3");
156
+
157
+ // Full-duplex realtime audio: returns { wsUrl, token, expiresInSeconds }.
158
+ // Connect a WebSocket to wsUrl and exchange RAW binary PCM16 LE frames
159
+ // (this is a plain WebSocket transport, NOT WebRTC; token is single-use, ~2 min)
160
+ const session = await client.calls.realtimeSession(call.id, "talk");
90
161
  ```
91
162
 
92
163
  ## Webhooks (parse / validation)
@@ -112,7 +183,8 @@ Notes:
112
183
  - `message.received` includes `fromMe` (boolean).
113
184
  - `message.group` is delivered for inbound group messages (includes `groupName`).
114
185
  - `message.newsletter` is delivered for inbound WhatsApp channel / newsletter messages (`@newsletter`, includes `newsletterId`).
115
- - Supported events in the parser: `message.sent`, `message.delivered`, `message.read`, `message.failed`, `message.reply`, `message.received`, `message.group`, `message.newsletter`, `optin.created`.
186
+ - Supported events in the parser: `message.sent`, `message.delivered`, `message.read`, `message.failed`, `message.reply`, `message.received`, `message.group`, `message.newsletter`, `number.created`, `number.connected`, `number.disconnected`, `number.removed`, `call.ringing`, `call.connected`, `call.ended`, `call.missed`, `call.permission_updated`.
187
+ - `call.*` payloads are **flat** (fields sit next to `event`, no `data` wrapper): `{ event, callId, externalCallId?, direction, status, from, to, timestamp, duration? }`. `duration` (seconds) appears on `call.ended` only when the call was answered; `call.permission_updated` has `callId`/`direction` `null` and `status` `NO_PERMISSION` | `TEMPORARY` | `PERMANENT`.
116
188
 
117
189
  ## Errors
118
190
 
package/dist/client.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { AnalyticsResource } from "./resources/analytics.js";
2
+ import { CallsResource } from "./resources/calls.js";
2
3
  import { MessagesResource } from "./resources/messages.js";
3
4
  import { ApiKeysResource } from "./resources/api-keys.js";
4
5
  import { NumbersResource } from "./resources/numbers.js";
@@ -6,6 +7,8 @@ import { ProjectsResource } from "./resources/projects.js";
6
7
  import { TemplatesResource } from "./resources/templates.js";
7
8
  import { GroupsResource } from "./resources/groups.js";
8
9
  import { NewslettersResource } from "./resources/newsletters.js";
10
+ import { RemotePairingResource } from "./resources/remote-pairing.js";
11
+ import { MediaResource } from "./resources/media.js";
9
12
  import { type FetchLike } from "./http.js";
10
13
  export type PilotStatusClientOptions = {
11
14
  apiKey: string;
@@ -23,6 +26,9 @@ export declare class PilotStatusClient {
23
26
  readonly templates: TemplatesResource;
24
27
  readonly groups: GroupsResource;
25
28
  readonly newsletters: NewslettersResource;
29
+ readonly remotePairing: RemotePairingResource;
30
+ readonly media: MediaResource;
31
+ readonly calls: CallsResource;
26
32
  constructor(options: PilotStatusClientOptions);
27
33
  }
28
34
  //# sourceMappingURL=client.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,gBAAgB,E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MessagesResource } from "./resources/messages.js";
3
4
  import { ApiKeysResource } from "./resources/api-keys.js";
4
5
  import { NumbersResource } from "./resources/numbers.js";
@@ -6,6 +7,8 @@ import { ProjectsResource } from "./resources/projects.js";
6
7
  import { TemplatesResource } from "./resources/templates.js";
7
8
  import { GroupsResource } from "./resources/groups.js";
8
9
  import { NewslettersResource } from "./resources/newsletters.js";
10
+ import { RemotePairingResource } from "./resources/remote-pairing.js";
11
+ import { MediaResource } from "./resources/media.js";
9
12
  import { createHttpClient } from "./http.js";
10
13
  export class PilotStatusClient {
11
14
  messages;
@@ -16,13 +19,16 @@ export class PilotStatusClient {
16
19
  templates;
17
20
  groups;
18
21
  newsletters;
22
+ remotePairing;
23
+ media;
24
+ calls;
19
25
  constructor(options) {
20
26
  const fetchImpl = options.fetch ?? globalThis.fetch;
21
27
  if (!fetchImpl) {
22
28
  throw new Error("fetch is not available in this runtime; pass { fetch } to PilotStatusClient");
23
29
  }
24
30
  const http = createHttpClient({
25
- baseUrl: "https://pilotstatus.online",
31
+ baseUrl: "https://pilotstatus.com.br",
26
32
  apiKey: options.apiKey,
27
33
  timeoutMs: options.timeoutMs ?? 30_000,
28
34
  userAgent: options.userAgent,
@@ -37,6 +43,9 @@ export class PilotStatusClient {
37
43
  this.templates = new TemplatesResource(http);
38
44
  this.groups = new GroupsResource(http);
39
45
  this.newsletters = new NewslettersResource(http);
46
+ this.remotePairing = new RemotePairingResource(http);
47
+ this.media = new MediaResource(http);
48
+ this.calls = new CallsResource(http);
40
49
  }
41
50
  }
42
51
  //# sourceMappingURL=client.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,eAA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http.d.ts CHANGED
@@ -8,7 +8,7 @@ export type HttpClientOptions = {
8
8
  getRetries: number;
9
9
  };
10
10
  export type HttpRequest = {
11
- method: "GET" | "POST" | "DELETE";
11
+ method: "GET" | "POST" | "PUT" | "DELETE";
12
12
  path: string;
13
13
  query?: Record<string, string | number | boolean | undefined | null>;
14
14
  body?: unknown;
@@ -1 +1 @@
1
- {"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../src/http.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,SAAS,GAAG,OAAO,KAAK,CAAC;AAErC,MAAM,MAAM,iBAAiB,GAAG;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,SAAS,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACtB,MAAM,EAAE,KAAK,GAAG,MAAM,GAAG,QAAQ,CAAC;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,GAAG,IAAI,CAAC,CAAC;IACrE,IAAI,CAAC,EAAE,OAAO,CAAC;CAClB,CAAC;AA+CF,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,iBAAiB;kBAG5B,CAAC,OAAO,WAAW,KAAG,OAAO,CAAC,CAAC,CAAC;EA8E9D;AAED,MAAM,MAAM,UAAU,GAAG,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAC"}
1
+ {"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../src/http.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,SAAS,GAAG,OAAO,KAAK,CAAC;AAErC,MAAM,MAAM,iBAAiB,GAAG;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,SAAS,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACtB,MAAM,EAAE,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,QAAQ,CAAC;IAC1C,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,GAAG,IAAI,CAAC,CAAC;IACrE,IAAI,CAAC,EAAE,OAAO,CAAC;CAClB,CAAC;AA+CF,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,iBAAiB;kBAG5B,CAAC,OAAO,WAAW,KAAG,OAAO,CAAC,CAAC,CAAC;EA8E9D;AAED,MAAM,MAAM,UAAU,GAAG,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAC"}
package/dist/index.d.ts CHANGED
@@ -2,7 +2,8 @@ export { PilotStatusClient } from "./client.js";
2
2
  export type { PilotStatusClientOptions } from "./client.js";
3
3
  export { PilotStatusError, PilotStatusHttpError, AuthenticationError, ValidationError, ForbiddenError, NotFoundError, ConflictError, RateLimitError, ServerError, } from "./errors.js";
4
4
  export type { PilotStatusErrorBody } from "./errors.js";
5
- export type { Environment, MessageStatus, Button, ButtonType, MarketingOptions, SendMessageInput, SendMessageAccepted, MessageDetails, DashboardStats, OptInCheckResult, Project, CreateProjectInput, ApiKeyCreateInput, ApiKeyCreated, ApiKeyListItem, WhatsAppNumberInstance, WhatsAppNumberListItem, NumberListItemApiKeyRef, CreateNumberInput, CreateNumberResult, NumberConnectResult, NumberStatusResult, NumberLinkBundle, NumberUpgradeToDualResult, InstanceLinkInfo, RemotePairingInput, RemotePairingResult, DeleteNumberResult, TemplateListItem, TemplateDetail, GroupListItem, NewsletterListItem, } from "./types.js";
6
- export type { CustomerWebhookEvent, MessageSentEvent, MessageDeliveredEvent, MessageReadEvent, MessageFailedEvent, MessageReplyEvent, MessageReceivedEvent, MessageGroupEvent, MessageNewsletterEvent, OptinCreatedEvent, } from "./webhooks/types.js";
5
+ export { NUMBER_STATUS_FAILURE_CODES } from "./types.js";
6
+ export type { MessageStatus, Button, ButtonType, MarketingOptions, SendMessageInput, SendMessageHeader, SendMessageAccepted, MessageDetails, DashboardStats, Project, CreateProjectInput, ApiKeyCreated, ApiKeyListItem, NumberApiKeyReveal, RegeneratedNumberKey, WhatsAppNumberInstance, WhatsAppNumberListItem, NumberListItemApiKeyRef, CreateNumberInput, CreateNumberResult, NumberConnectResult, NumberStatusResult, NumberStatusFailureCode, NumberLinkBundle, RemotePairingInput, RemotePairingResult, RemotePairingInfo, RemotePairingStatus, RemotePairingConnectResult, CancelMessagesResult, DeleteNumberResult, TemplateListItem, TemplateDetail, GroupListItem, NewsletterListItem, MediaDownloadResult, CallDirection, CallStatus, CallDetails, CallInitiateInput, CallInitiateAccepted, CallActionResult, CallListResult, CallingSettingsResult, CallSettingsUpdateInput, CallSettingsUpdateResult, CallPermissionResult, CallPermissionRequestInput, CallPermissionRequestResult, CallRealtimeSessionMode, CallRealtimeSessionResult, } from "./types.js";
7
+ export type { CustomerWebhookEvent, WhatsAppMessageType, MessageSentEvent, MessageDeliveredEvent, MessageReadEvent, MessageFailedEvent, MessageReplyEvent, MessageReceivedEvent, MessageGroupEvent, MessageNewsletterEvent, NumberCreatedEvent, NumberConnectedEvent, NumberDisconnectedEvent, NumberRemovedEvent, CallRingingEvent, CallConnectedEvent, CallEndedEvent, CallMissedEvent, CallPermissionUpdatedEvent, EvolutionGoCallEventData, EvolutionGoCallOfferEvent, EvolutionGoCallAcceptEvent, EvolutionGoCallTerminateEvent, EvolutionGoCallEvent, } from "./webhooks/types.js";
7
8
  export { parseCustomerWebhook, isCustomerWebhookEvent } from "./webhooks/parse.js";
8
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,YAAY,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAE5D,OAAO,EACH,gBAAgB,EAChB,oBAAoB,EACpB,mBAAmB,EACnB,eAAe,EACf,cAAc,EACd,aAAa,EACb,aAAa,EACb,cAAc,EACd,WAAW,GACd,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAExD,YAAY,EACR,WAAW,EACX,aAAa,EACb,MAAM,EACN,UAAU,EACV,gBAAgB,EAChB,gBAAgB,EAChB,mBAAmB,EACnB,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,OAAO,EACP,kBAAkB,EAClB,iBAAiB,EACjB,aAAa,EACb,cAAc,EACd,sBAAsB,EACtB,sBAAsB,EACtB,uBAAuB,EACvB,iBAAiB,EACjB,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,EAChB,yBAAyB,EACzB,gBAAgB,EAChB,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,EAChB,cAAc,EACd,aAAa,EACb,kBAAkB,GACrB,MAAM,YAAY,CAAC;AAEpB,YAAY,EACR,oBAAoB,EACpB,gBAAgB,EAChB,qBAAqB,EACrB,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EACjB,oBAAoB,EACpB,iBAAiB,EACjB,sBAAsB,EACtB,iBAAiB,GACpB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,YAAY,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAA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ACd,eAAe,EACf,0BAA0B,EAC1B,wBAAwB,EACxB,yBAAyB,EACzB,0BAA0B,EAC1B,6BAA6B,EAC7B,oBAAoB,GACrB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC"}
package/dist/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  export { PilotStatusClient } from "./client.js";
2
2
  export { PilotStatusError, PilotStatusHttpError, AuthenticationError, ValidationError, ForbiddenError, NotFoundError, ConflictError, RateLimitError, ServerError, } from "./errors.js";
3
+ export { NUMBER_STATUS_FAILURE_CODES } from "./types.js";
3
4
  export { parseCustomerWebhook, isCustomerWebhookEvent } from "./webhooks/parse.js";
4
5
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAGhD,OAAO,EACH,gBAAgB,EAChB,oBAAoB,EACpB,mBAAmB,EACnB,eAAe,EACf,cAAc,EACd,aAAa,EACb,aAAa,EACb,cAAc,EACd,WAAW,GACd,MAAM,aAAa,CAAC;AAkDrB,OAAO,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAGhD,OAAO,EACL,gBAAgB,EAChB,oBAAoB,EACpB,mBAAmB,EACnB,eAAe,EACf,cAAc,EACd,aAAa,EACb,aAAa,EACb,cAAc,EACd,WAAW,GACZ,MAAM,aAAa,CAAC;AAGrB,OAAO,EAAE,2BAA2B,EAAE,MAAM,YAAY,CAAC;AAkFzD,OAAO,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC"}
@@ -1,9 +1,26 @@
1
1
  import type { HttpClient } from "../http.js";
2
- import type { ApiKeyCreateInput, ApiKeyCreated, ApiKeyListItem } from "../types.js";
2
+ import type { ApiKeyListItem, RegeneratedNumberKey } from "../types.js";
3
3
  export declare class ApiKeysResource {
4
4
  #private;
5
5
  constructor(http: HttpClient);
6
+ /**
7
+ * List API keys (`GET /v1/api-keys`).
8
+ *
9
+ * With a NUMBER-scoped key this returns that number's masked keys
10
+ * (`ApiKeyListItem[]`).
11
+ *
12
+ * With a TENANT-scoped key the endpoint instead returns a lean per-number list
13
+ * (`NumberApiKeyReveal[]`) — one entry per number carrying the real usable
14
+ * `key` when `revealable` is true.
15
+ */
6
16
  list(): Promise<ApiKeyListItem[]>;
7
- create(input: ApiKeyCreateInput): Promise<ApiKeyCreated>;
17
+ /**
18
+ * Regenerate the default key of one WhatsApp number (`POST /v1/api-keys`).
19
+ *
20
+ * Tenant-scoped action — there is no "create another key" concept. It rotates
21
+ * the default key of the number identified by `whatsappNumberId`, revokes the
22
+ * previous key, and returns the new usable key (shown once).
23
+ */
24
+ regenerateNumber(whatsappNumberId: string): Promise<RegeneratedNumberKey>;
8
25
  }
9
26
  //# sourceMappingURL=api-keys.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"api-keys.d.ts","sourceRoot":"","sources":["../../src/resources/api-keys.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAEpF,qBAAa,eAAe;;gBAGZ,IAAI,EAAE,UAAU;IAItB,IAAI,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC;IAOjC,MAAM,CAAC,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAAC,aAAa,CAAC;CAgBjE"}
1
+ {"version":3,"file":"api-keys.d.ts","sourceRoot":"","sources":["../../src/resources/api-keys.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,KAAK,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAExE,qBAAa,eAAe;;gBAGd,IAAI,EAAE,UAAU;IAI5B;;;;;;;;;OASG;IACG,IAAI,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC;IAOvC;;;;;;OAMG;IACG,gBAAgB,CAAC,gBAAgB,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,CAAC;CAOhF"}
@@ -3,26 +3,34 @@ export class ApiKeysResource {
3
3
  constructor(http) {
4
4
  this.#http = http;
5
5
  }
6
+ /**
7
+ * List API keys (`GET /v1/api-keys`).
8
+ *
9
+ * With a NUMBER-scoped key this returns that number's masked keys
10
+ * (`ApiKeyListItem[]`).
11
+ *
12
+ * With a TENANT-scoped key the endpoint instead returns a lean per-number list
13
+ * (`NumberApiKeyReveal[]`) — one entry per number carrying the real usable
14
+ * `key` when `revealable` is true.
15
+ */
6
16
  async list() {
7
17
  return this.#http.requestJson({
8
18
  method: "GET",
9
19
  path: "/v1/api-keys",
10
20
  });
11
21
  }
12
- async create(input) {
22
+ /**
23
+ * Regenerate the default key of one WhatsApp number (`POST /v1/api-keys`).
24
+ *
25
+ * Tenant-scoped action — there is no "create another key" concept. It rotates
26
+ * the default key of the number identified by `whatsappNumberId`, revokes the
27
+ * previous key, and returns the new usable key (shown once).
28
+ */
29
+ async regenerateNumber(whatsappNumberId) {
13
30
  return this.#http.requestJson({
14
31
  method: "POST",
15
32
  path: "/v1/api-keys",
16
- body: {
17
- name: input.name,
18
- ...(input.webhookId !== undefined ? { webhookId: input.webhookId } : {}),
19
- ...(input.whatsappInstanceId !== undefined
20
- ? { whatsappInstanceId: input.whatsappInstanceId }
21
- : {}),
22
- ...(input.retentionDays !== undefined
23
- ? { retentionDays: input.retentionDays }
24
- : {}),
25
- },
33
+ body: { whatsappNumberId },
26
34
  });
27
35
  }
28
36
  }
@@ -1 +1 @@
1
- {"version":3,"file":"api-keys.js","sourceRoot":"","sources":["../../src/resources/api-keys.ts"],"names":[],"mappings":"AAGA,MAAM,OAAO,eAAe;IACf,KAAK,CAAa;IAE3B,YAAY,IAAgB;QACxB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACtB,CAAC;IAED,KAAK,CAAC,IAAI;QACN,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,CAAmB;YAC5C,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,cAAc;SACvB,CAAC,CAAC;IACP,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,KAAwB;QACjC,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,CAAgB;YACzC,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,cAAc;YACpB,IAAI,EAAE;gBACF,IAAI,EAAE,KAAK,CAAC,IAAI;gBAChB,GAAG,CAAC,KAAK,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;gBACxE,GAAG,CAAC,KAAK,CAAC,kBAAkB,KAAK,SAAS;oBACtC,CAAC,CAAC,EAAE,kBAAkB,EAAE,KAAK,CAAC,kBAAkB,EAAE;oBAClD,CAAC,CAAC,EAAE,CAAC;gBACT,GAAG,CAAC,KAAK,CAAC,aAAa,KAAK,SAAS;oBACjC,CAAC,CAAC,EAAE,aAAa,EAAE,KAAK,CAAC,aAAa,EAAE;oBACxC,CAAC,CAAC,EAAE,CAAC;aACZ;SACJ,CAAC,CAAC;IACP,CAAC;CACJ"}
1
+ {"version":3,"file":"api-keys.js","sourceRoot":"","sources":["../../src/resources/api-keys.ts"],"names":[],"mappings":"AAGA,MAAM,OAAO,eAAe;IACjB,KAAK,CAAa;IAE3B,YAAY,IAAgB;QAC1B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACpB,CAAC;IAED;;;;;;;;;OASG;IACH,KAAK,CAAC,IAAI;QACR,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,CAAmB;YAC9C,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,cAAc;SACrB,CAAC,CAAC;IACL,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,gBAAgB,CAAC,gBAAwB;QAC7C,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,CAAuB;YAClD,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,cAAc;YACpB,IAAI,EAAE,EAAE,gBAAgB,EAAE;SAC3B,CAAC,CAAC;IACL,CAAC;CACF"}
@@ -0,0 +1,72 @@
1
+ import type { HttpClient } from "../http.js";
2
+ import type { CallActionResult, CallDetails, CallInitiateAccepted, CallInitiateInput, CallListResult, CallPermissionRequestInput, CallPermissionRequestResult, CallPermissionResult, CallRealtimeSessionMode, CallRealtimeSessionResult, CallSettingsUpdateInput, CallSettingsUpdateResult, CallingSettingsResult } from "../types.js";
3
+ /**
4
+ * WhatsApp Business Calling (`/v1/calls*`) — Meta Cloud API AND web
5
+ * (Pilot Status) numbers; any other provider gets `400 FEATURE_NOT_SUPPORTED`.
6
+ *
7
+ * - **Meta**: signaling-only — `initiate`/`accept`/`preAccept` carry the SDP
8
+ * (RFC 8866) produced by YOUR WebRTC client; media flows browser↔WhatsApp
9
+ * directly. `preAccept`/settings/permissions are Meta-only.
10
+ * - **Web (Pilot Status) numbers**: call media is handled server-side — there
11
+ * is NO SDP ever (omit `sdp` on `initiate`/`accept`). Extra media controls:
12
+ * `play` (stream an audio file into the call) and `realtimeSession`
13
+ * (full-duplex PCM16 WebSocket). No call permission is needed before
14
+ * `initiate` and there is no Meta per-minute billing.
15
+ *
16
+ * `callId` arguments accept the Pilot Status id (`call_...`) OR the provider
17
+ * call id (Meta `wacid...` / Evolution GO CallID).
18
+ */
19
+ export declare class CallsResource {
20
+ #private;
21
+ constructor(http: HttpClient);
22
+ /**
23
+ * Start a business-initiated call (BIC). On Meta numbers `sdp` is required
24
+ * and a prior user call permission is needed; on web (Pilot Status) numbers
25
+ * omit `sdp` — no permission step and no Meta billing.
26
+ */
27
+ initiate(input: CallInitiateInput): Promise<CallInitiateAccepted>;
28
+ /** List the number's calls, newest first (`limit` 1–100, `before` ISO 8601 cursor). */
29
+ list(params?: {
30
+ limit?: number;
31
+ before?: string;
32
+ }): Promise<CallListResult>;
33
+ /** One call; `includeSdp: true` adds `sdpOffer`/`sdpAnswer` (needed to answer a UIC). */
34
+ get(callId: string, params?: {
35
+ includeSdp?: boolean;
36
+ }): Promise<CallDetails>;
37
+ /** OPTIONAL early SDP answer (reduces clipping); the call connects only on accept. Meta-only. */
38
+ preAccept(callId: string, sdp: string): Promise<CallActionResult>;
39
+ /**
40
+ * Answer an inbound (user-initiated) call. On Meta numbers pass the
41
+ * business-side SDP answer; on web (Pilot Status) numbers omit `sdp`.
42
+ */
43
+ accept(callId: string, sdp?: string): Promise<CallActionResult>;
44
+ /** Decline an incoming call (no body). */
45
+ reject(callId: string): Promise<CallActionResult>;
46
+ /** Hang up an active call (no body). */
47
+ terminate(callId: string): Promise<CallActionResult>;
48
+ /**
49
+ * Play an audio file into an active call — web (Pilot Status) numbers only
50
+ * (Meta numbers get `400 FEATURE_NOT_SUPPORTED`). `mediaUrl` must be a public
51
+ * http(s) URL of an `.mp3`/`.wav`/`.opus` file; when the call is not active
52
+ * yet the audio is queued and starts as soon as it connects.
53
+ */
54
+ play(callId: string, mediaUrl: string): Promise<CallActionResult>;
55
+ /**
56
+ * Open a short-lived full-duplex realtime media session on an active call —
57
+ * web (Pilot Status) numbers only. `mode: "talk"` sends mic audio AND
58
+ * receives peer audio; `"listen"` only receives. Returns `{ wsUrl, token,
59
+ * expiresInSeconds }`: connect a WebSocket to `wsUrl` and exchange raw
60
+ * binary PCM16 LE frames (NOT WebRTC; the token is single-use, ~2 min).
61
+ */
62
+ realtimeSession(callId: string, mode: CallRealtimeSessionMode): Promise<CallRealtimeSessionResult>;
63
+ /** Read the number's `calling` settings object. Meta-only. */
64
+ getSettings(): Promise<CallingSettingsResult>;
65
+ /** Partial update; a posted `call_hours` REPLACES the stored object entirely. Meta-only. */
66
+ updateSettings(input: CallSettingsUpdateInput): Promise<CallSettingsUpdateResult>;
67
+ /** Probe whether the business may call `to` (required before a Meta BIC). Meta-only. */
68
+ getPermissions(to: string): Promise<CallPermissionResult>;
69
+ /** Send the interactive call-permission request (inside the 24h service window). Meta-only. */
70
+ requestPermission(input: CallPermissionRequestInput): Promise<CallPermissionRequestResult>;
71
+ }
72
+ //# sourceMappingURL=calls.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"calls.d.ts","sourceRoot":"","sources":["../../src/resources/calls.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,KAAK,EACV,gBAAgB,EAChB,WAAW,EACX,oBAAoB,EACpB,iBAAiB,EACjB,cAAc,EACd,0BAA0B,EAC1B,2BAA2B,EAC3B,oBAAoB,EACpB,uBAAuB,EACvB,yBAAyB,EACzB,uBAAuB,EACvB,wBAAwB,EACxB,qBAAqB,EACtB,MAAM,aAAa,CAAC;AAErB;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,aAAa;;gBAGZ,IAAI,EAAE,UAAU;IAI5B;;;;OAIG;IACG,QAAQ,CAAC,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAcvE,uFAAuF;IACjF,IAAI,CAAC,MAAM,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,cAAc,CAAC;IAQjF,yFAAyF;IACnF,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE;QAAE,UAAU,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,OAAO,CAAC,WAAW,CAAC;IAQlF,iGAAiG;IAC3F,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAQvE;;;OAGG;IACG,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAQrE,0CAA0C;IACpC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAOvD,wCAAwC;IAClC,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAO1D;;;;;OAKG;IACG,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAQvE;;;;;;OAMG;IACG,eAAe,CACnB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,uBAAuB,GAC5B,OAAO,CAAC,yBAAyB,CAAC;IAQrC,8DAA8D;IACxD,WAAW,IAAI,OAAO,CAAC,qBAAqB,CAAC;IAOnD,4FAA4F;IACtF,cAAc,CAAC,KAAK,EAAE,uBAAuB,GAAG,OAAO,CAAC,wBAAwB,CAAC;IAQvF,wFAAwF;IAClF,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAQ/D,+FAA+F;IACzF,iBAAiB,CACrB,KAAK,EAAE,0BAA0B,GAChC,OAAO,CAAC,2BAA2B,CAAC;CAUxC"}
@@ -0,0 +1,151 @@
1
+ /**
2
+ * WhatsApp Business Calling (`/v1/calls*`) — Meta Cloud API AND web
3
+ * (Pilot Status) numbers; any other provider gets `400 FEATURE_NOT_SUPPORTED`.
4
+ *
5
+ * - **Meta**: signaling-only — `initiate`/`accept`/`preAccept` carry the SDP
6
+ * (RFC 8866) produced by YOUR WebRTC client; media flows browser↔WhatsApp
7
+ * directly. `preAccept`/settings/permissions are Meta-only.
8
+ * - **Web (Pilot Status) numbers**: call media is handled server-side — there
9
+ * is NO SDP ever (omit `sdp` on `initiate`/`accept`). Extra media controls:
10
+ * `play` (stream an audio file into the call) and `realtimeSession`
11
+ * (full-duplex PCM16 WebSocket). No call permission is needed before
12
+ * `initiate` and there is no Meta per-minute billing.
13
+ *
14
+ * `callId` arguments accept the Pilot Status id (`call_...`) OR the provider
15
+ * call id (Meta `wacid...` / Evolution GO CallID).
16
+ */
17
+ export class CallsResource {
18
+ #http;
19
+ constructor(http) {
20
+ this.#http = http;
21
+ }
22
+ /**
23
+ * Start a business-initiated call (BIC). On Meta numbers `sdp` is required
24
+ * and a prior user call permission is needed; on web (Pilot Status) numbers
25
+ * omit `sdp` — no permission step and no Meta billing.
26
+ */
27
+ async initiate(input) {
28
+ return this.#http.requestJson({
29
+ method: "POST",
30
+ path: "/v1/calls",
31
+ body: {
32
+ to: input.to,
33
+ ...(input.sdp ? { sdp: input.sdp } : {}),
34
+ ...(input.bizOpaqueCallbackData
35
+ ? { bizOpaqueCallbackData: input.bizOpaqueCallbackData }
36
+ : {}),
37
+ },
38
+ });
39
+ }
40
+ /** List the number's calls, newest first (`limit` 1–100, `before` ISO 8601 cursor). */
41
+ async list(params) {
42
+ return this.#http.requestJson({
43
+ method: "GET",
44
+ path: "/v1/calls",
45
+ query: { limit: params?.limit, before: params?.before },
46
+ });
47
+ }
48
+ /** One call; `includeSdp: true` adds `sdpOffer`/`sdpAnswer` (needed to answer a UIC). */
49
+ async get(callId, params) {
50
+ return this.#http.requestJson({
51
+ method: "GET",
52
+ path: `/v1/calls/${encodeURIComponent(callId)}`,
53
+ query: { includeSdp: params?.includeSdp ? "1" : undefined },
54
+ });
55
+ }
56
+ /** OPTIONAL early SDP answer (reduces clipping); the call connects only on accept. Meta-only. */
57
+ async preAccept(callId, sdp) {
58
+ return this.#http.requestJson({
59
+ method: "POST",
60
+ path: `/v1/calls/${encodeURIComponent(callId)}/pre-accept`,
61
+ body: { sdp },
62
+ });
63
+ }
64
+ /**
65
+ * Answer an inbound (user-initiated) call. On Meta numbers pass the
66
+ * business-side SDP answer; on web (Pilot Status) numbers omit `sdp`.
67
+ */
68
+ async accept(callId, sdp) {
69
+ return this.#http.requestJson({
70
+ method: "POST",
71
+ path: `/v1/calls/${encodeURIComponent(callId)}/accept`,
72
+ body: { ...(sdp ? { sdp } : {}) },
73
+ });
74
+ }
75
+ /** Decline an incoming call (no body). */
76
+ async reject(callId) {
77
+ return this.#http.requestJson({
78
+ method: "POST",
79
+ path: `/v1/calls/${encodeURIComponent(callId)}/reject`,
80
+ });
81
+ }
82
+ /** Hang up an active call (no body). */
83
+ async terminate(callId) {
84
+ return this.#http.requestJson({
85
+ method: "POST",
86
+ path: `/v1/calls/${encodeURIComponent(callId)}/terminate`,
87
+ });
88
+ }
89
+ /**
90
+ * Play an audio file into an active call — web (Pilot Status) numbers only
91
+ * (Meta numbers get `400 FEATURE_NOT_SUPPORTED`). `mediaUrl` must be a public
92
+ * http(s) URL of an `.mp3`/`.wav`/`.opus` file; when the call is not active
93
+ * yet the audio is queued and starts as soon as it connects.
94
+ */
95
+ async play(callId, mediaUrl) {
96
+ return this.#http.requestJson({
97
+ method: "POST",
98
+ path: `/v1/calls/${encodeURIComponent(callId)}/play`,
99
+ body: { mediaUrl },
100
+ });
101
+ }
102
+ /**
103
+ * Open a short-lived full-duplex realtime media session on an active call —
104
+ * web (Pilot Status) numbers only. `mode: "talk"` sends mic audio AND
105
+ * receives peer audio; `"listen"` only receives. Returns `{ wsUrl, token,
106
+ * expiresInSeconds }`: connect a WebSocket to `wsUrl` and exchange raw
107
+ * binary PCM16 LE frames (NOT WebRTC; the token is single-use, ~2 min).
108
+ */
109
+ async realtimeSession(callId, mode) {
110
+ return this.#http.requestJson({
111
+ method: "POST",
112
+ path: `/v1/calls/${encodeURIComponent(callId)}/realtime-session`,
113
+ body: { mode },
114
+ });
115
+ }
116
+ /** Read the number's `calling` settings object. Meta-only. */
117
+ async getSettings() {
118
+ return this.#http.requestJson({
119
+ method: "GET",
120
+ path: "/v1/calls/settings",
121
+ });
122
+ }
123
+ /** Partial update; a posted `call_hours` REPLACES the stored object entirely. Meta-only. */
124
+ async updateSettings(input) {
125
+ return this.#http.requestJson({
126
+ method: "PUT",
127
+ path: "/v1/calls/settings",
128
+ body: input,
129
+ });
130
+ }
131
+ /** Probe whether the business may call `to` (required before a Meta BIC). Meta-only. */
132
+ async getPermissions(to) {
133
+ return this.#http.requestJson({
134
+ method: "GET",
135
+ path: "/v1/calls/permissions",
136
+ query: { to },
137
+ });
138
+ }
139
+ /** Send the interactive call-permission request (inside the 24h service window). Meta-only. */
140
+ async requestPermission(input) {
141
+ return this.#http.requestJson({
142
+ method: "POST",
143
+ path: "/v1/calls/permissions/request",
144
+ body: {
145
+ to: input.to,
146
+ ...(input.text ? { text: input.text } : {}),
147
+ },
148
+ });
149
+ }
150
+ }
151
+ //# sourceMappingURL=calls.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"calls.js","sourceRoot":"","sources":["../../src/resources/calls.ts"],"names":[],"mappings":"AAiBA;;;;;;;;;;;;;;;GAeG;AACH,MAAM,OAAO,aAAa;IACf,KAAK,CAAa;IAE3B,YAAY,IAAgB;QAC1B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACpB,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,QAAQ,CAAC,KAAwB;QACrC,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,CAAuB;YAClD,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,WAAW;YACjB,IAAI,EAAE;gBACJ,EAAE,EAAE,KAAK,CAAC,EAAE;gBACZ,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;gBACxC,GAAG,CAAC,KAAK,CAAC,qBAAqB;oBAC7B,CAAC,CAAC,EAAE,qBAAqB,EAAE,KAAK,CAAC,qBAAqB,EAAE;oBACxD,CAAC,CAAC,EAAE,CAAC;aACR;SACF,CAAC,C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YAC1B,IAAI,EAAE,KAAK;SACZ,CAAC,CAAC;IACL,CAAC;IAED,wFAAwF;IACxF,KAAK,CAAC,cAAc,CAAC,EAAU;QAC7B,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,CAAuB;YAClD,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,uBAAuB;YAC7B,KAAK,EAAE,EAAE,EAAE,EAAE;SACd,CAAC,CAAC;IACL,CAAC;IAED,+FAA+F;IAC/F,KAAK,CAAC,iBAAiB,CACrB,KAAiC;QAEjC,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,CAA8B;YACzD,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,+BAA+B;YACrC,IAAI,EAAE;gBACJ,EAAE,EAAE,KAAK,CAAC,EAAE;gBACZ,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aAC5C;SACF,CAAC,CAAC;IACL,CAAC;CACF"}
@@ -0,0 +1,8 @@
1
+ import type { HttpClient } from "../http.js";
2
+ import type { MediaDownloadResult } from "../types.js";
3
+ export declare class MediaResource {
4
+ #private;
5
+ constructor(http: HttpClient);
6
+ download(mediaId: string, phoneNumberId: string): Promise<MediaDownloadResult>;
7
+ }
8
+ //# sourceMappingURL=media.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"media.d.ts","sourceRoot":"","sources":["../../src/resources/media.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAEvD,qBAAa,aAAa;;gBAGZ,IAAI,EAAE,UAAU;IAItB,QAAQ,CACZ,OAAO,EAAE,MAAM,EACf,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC,mBAAmB,CAAC;CAOhC"}
@@ -0,0 +1,14 @@
1
+ export class MediaResource {
2
+ #http;
3
+ constructor(http) {
4
+ this.#http = http;
5
+ }
6
+ async download(mediaId, phoneNumberId) {
7
+ return this.#http.requestJson({
8
+ method: "GET",
9
+ path: `/v1/media/${encodeURIComponent(mediaId)}`,
10
+ query: { phoneNumberId },
11
+ });
12
+ }
13
+ }
14
+ //# sourceMappingURL=media.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"media.js","sourceRoot":"","sources":["../../src/resources/media.ts"],"names":[],"mappings":"AAGA,MAAM,OAAO,aAAa;IACf,KAAK,CAAa;IAE3B,YAAY,IAAgB;QAC1B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACpB,CAAC;IAED,KAAK,CAAC,QAAQ,CACZ,OAAe,EACf,aAAqB;QAErB,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,CAAsB;YACjD,MAAM,EAAE,KAAK;YACb,IAAI,EAAE,aAAa,kBAAkB,CAAC,OAAO,CAAC,EAAE;YAChD,KAAK,EAAE,EAAE,aAAa,EAAE;SACzB,CAAC,CAAC;IACL,CAAC;CACF"}