@signalhousellc/sdk 1.0.62 → 1.0.64
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/package.json +1 -1
- package/src/domains/Groups.js +18 -0
- package/src/domains/Messages.js +10 -10
- package/src/domains/Voice.js +3 -0
- package/src/domains/voice/Analytics.js +76 -0
- package/src/domains/voice/SipProfiles.js +19 -13
package/package.json
CHANGED
package/src/domains/Groups.js
CHANGED
|
@@ -53,6 +53,24 @@ export class Groups {
|
|
|
53
53
|
return this.client(`/group/${safeGroupId}`, { method: "DELETE", ...options });
|
|
54
54
|
},
|
|
55
55
|
|
|
56
|
+
/**
|
|
57
|
+
* Set a group's KYC complianceStatus (SHGHL-2740). Only flips the field — it does not
|
|
58
|
+
* trigger any lockout side effects (halted sends, revoked API keys, etc.) for "rejected".
|
|
59
|
+
* @async
|
|
60
|
+
* @roles signalhouse
|
|
61
|
+
* @param {Object} params - The parameters for updating a group's compliance status
|
|
62
|
+
* @param {string} params.groupId - The ID of the group to update
|
|
63
|
+
* @param {string} params.complianceStatus - One of "unverified", "pending", "verified", "rejected"
|
|
64
|
+
* @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
|
|
65
|
+
* @throws {Error} Throws an error if the groupId or complianceStatus parameter is missing
|
|
66
|
+
* @returns {Promise<Object>} - The updated group object returned from the server
|
|
67
|
+
*/
|
|
68
|
+
updateComplianceStatus: async ({ groupId, complianceStatus, options = {} }) => {
|
|
69
|
+
this.client._require({ groupId, complianceStatus });
|
|
70
|
+
const safeGroupId = encodeURIComponent(groupId);
|
|
71
|
+
return this.client(`/group/${safeGroupId}/compliance-status`, { method: "PUT", body: { complianceStatus }, ...options });
|
|
72
|
+
},
|
|
73
|
+
|
|
56
74
|
/**
|
|
57
75
|
* Link an external tenant (GHL/Shopify) to a V2 group (server-to-server). Exchanges a
|
|
58
76
|
* single-use link token for a canonical group, adopting an empty portal group, repointing
|
package/src/domains/Messages.js
CHANGED
|
@@ -18,10 +18,10 @@ export class Messages {
|
|
|
18
18
|
* @param {string} [params.status] - Filter messages by their status (ENQUEUED, DEQUEUED, SENT, FAILED, DELIVERED)
|
|
19
19
|
* @param {string} [params.direction] - Filter messages by their direction (INBOUND, OUTBOUND)
|
|
20
20
|
* @param {string|string[]} [params.messageType] - Filter messages by their type. Accepts a single value or an array (e.g. ["SMS", "MMS"]). Allowed values: SMS, MMS, RCS, WHATSAPP, VIBER, P2P. When omitted, defaults to all non-P2P types.
|
|
21
|
-
* @param {string|string[]} [params.channel] - Filter messages by channel. Accepts a single value or an array. Allowed values: tenDLC, tollFree, p2p. Each message records its channel when it is saved, and this filters on that stored value; older messages from before this feature have no channel and count as tenDLC. Ignored when matchAny is true (matchAny takes precedence).
|
|
21
|
+
* @param {string|string[]} [params.channel] - Filter messages by channel. Accepts a single value or an array. Allowed values: tenDLC, tollFree, shortCode, p2p. Each message records its channel when it is saved, and this filters on that stored value; older messages from before this feature have no channel and count as tenDLC. Ignored when matchAny is true (matchAny takes precedence).
|
|
22
22
|
* @param {boolean} [params.matchAny] - When true, the provided campaignId/brandId/phoneNumber filters are OR'd (a message matches ANY of them) instead of the default most-specific-single behavior. subgroupId stays an AND scope. Opt-in/additive.
|
|
23
23
|
* @param {string} [params.carrier] - Filter messages by the carrier used for sending
|
|
24
|
-
* @param {string} [params.senderPhoneNumber] - Filter messages by the sender's phone number
|
|
24
|
+
* @param {string} [params.senderPhoneNumber] - Filter messages by the sender's 5-6 digit Short Code or 10+ digit phone number
|
|
25
25
|
* @param {string} [params.recipientPhoneNumber] - Filter messages by the recipient's phone number
|
|
26
26
|
* @param {string} [params.startDate] - ISO-8601 date or timestamp; normalized to start-of-UTC-day (inclusive)
|
|
27
27
|
* @param {string} [params.endDate] - ISO-8601 date or timestamp; normalized to end-of-UTC-day (inclusive). Hourly resolution is not supported
|
|
@@ -94,7 +94,7 @@ export class Messages {
|
|
|
94
94
|
* @param {string} [params.startDate] - ISO-8601 date or timestamp; normalized to start-of-UTC-day (inclusive)
|
|
95
95
|
* @param {string} [params.endDate] - ISO-8601 date or timestamp; normalized to end-of-UTC-day (inclusive). Hourly resolution is not supported
|
|
96
96
|
* @param {boolean} [params.matchAny] - When true, the provided campaignId/brandId/phoneNumber filters are OR'd (match ANY) instead of the default most-specific-single behavior. subgroupId stays an AND scope. Opt-in/additive.
|
|
97
|
-
* @param {string|string[]} [params.channel] - Filter analytics by channel (tenDLC, tollFree, p2p). Filters on the stored channel column; a tenDLC selection also includes older messages that have no channel, and p2p is a real channel here (matched by carrier). Accepts a single value or an array. Ignored when matchAny is true (matchAny takes precedence).
|
|
97
|
+
* @param {string|string[]} [params.channel] - Filter analytics by channel (tenDLC, tollFree, shortCode, p2p). Filters on the stored channel column; a tenDLC selection also includes older messages that have no channel, and p2p is a real channel here (matched by carrier). Accepts a single value or an array. Ignored when matchAny is true (matchAny takes precedence).
|
|
98
98
|
* @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
|
|
99
99
|
* @returns {Promise<Object>} - A promise that resolves to the analytics data
|
|
100
100
|
*/
|
|
@@ -117,7 +117,7 @@ export class Messages {
|
|
|
117
117
|
* @param {string} [params.carrier] - Filter analytics by the carrier used for sending
|
|
118
118
|
* @param {string} [params.startDate] - ISO-8601 date or timestamp; normalized to start-of-UTC-day (inclusive)
|
|
119
119
|
* @param {string} [params.endDate] - ISO-8601 date or timestamp; normalized to end-of-UTC-day (inclusive). Hourly resolution is not supported
|
|
120
|
-
* @param {string|string[]} [params.channel] - Filter analytics by channel (tenDLC, tollFree, p2p). Filters on the stored channel column; a tenDLC selection also includes older messages that have no channel, and p2p is a real channel here. Accepts a single value or an array.
|
|
120
|
+
* @param {string|string[]} [params.channel] - Filter analytics by channel (tenDLC, tollFree, shortCode, p2p). Filters on the stored channel column; a tenDLC selection also includes older messages that have no channel, and p2p is a real channel here. Accepts a single value or an array.
|
|
121
121
|
* @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
|
|
122
122
|
* @returns {Promise<Array>} - A promise that resolves to an array of analytics snapshot records
|
|
123
123
|
*/
|
|
@@ -159,7 +159,7 @@ export class Messages {
|
|
|
159
159
|
* @param {string} [params.endDate]
|
|
160
160
|
* @param {number} [params.page=1]
|
|
161
161
|
* @param {number} [params.limit=50] - max 50 per page
|
|
162
|
-
* @param {("tenDLC"|"tollFree"|"p2p"|"both")|Array<"tenDLC"|"tollFree"|"p2p">} [params.channel="both"] - Filter and rank rows by the stored channel column. "both" (default) means all activity. tenDLC/tollFree/p2p (single value or array) limit to the selected channel(s)
|
|
162
|
+
* @param {("tenDLC"|"tollFree"|"shortCode"|"p2p"|"both")|Array<"tenDLC"|"tollFree"|"shortCode"|"p2p">} [params.channel="both"] - Filter and rank rows by the stored channel column. "both" (default) means all activity. tenDLC/tollFree/shortCode/p2p (single value or array) limit to the selected channel(s).
|
|
163
163
|
* @param {import('../SignalHouseSDK').RequestOptions} [params.options]
|
|
164
164
|
* @returns {Promise<Object>} - { rows, totalCount, page, limit }. Each row carries sms/mms/p2p metric columns plus `smsOptOuts` and `mmsOptOuts` from the DNC analytics MV (P2P has no opt-outs).
|
|
165
165
|
*/
|
|
@@ -185,7 +185,7 @@ export class Messages {
|
|
|
185
185
|
* @param {string} [params.endDate]
|
|
186
186
|
* @param {number} [params.page=1]
|
|
187
187
|
* @param {number} [params.limit=50] - max 50 per page
|
|
188
|
-
* @param {("tenDLC"|"tollFree"|"p2p"|"both")|Array<"tenDLC"|"tollFree"|"p2p">} [params.channel="both"] - Filter and rank rows by the stored channel column. "both" (default) means every code. tenDLC/tollFree/p2p (single value or array) limit to the selected channel(s); when one channel is selected, totalErrors reflects only that channel.
|
|
188
|
+
* @param {("tenDLC"|"tollFree"|"shortCode"|"p2p"|"both")|Array<"tenDLC"|"tollFree"|"shortCode"|"p2p">} [params.channel="both"] - Filter and rank rows by the stored channel column. "both" (default) means every code. tenDLC/tollFree/shortCode/p2p (single value or array) limit to the selected channel(s); when one channel is selected, totalErrors reflects only that channel.
|
|
189
189
|
* @param {import('../SignalHouseSDK').RequestOptions} [params.options]
|
|
190
190
|
* @returns {Promise<Object>} - { rows, totalCount, totalErrors: { sms, mms, p2p, all }, page, limit }
|
|
191
191
|
*/
|
|
@@ -208,7 +208,7 @@ export class Messages {
|
|
|
208
208
|
* @param {string} [params.carrier] - Filter by the carrier
|
|
209
209
|
* @param {string} [params.startDate] - ISO-8601 date or timestamp; normalized to start-of-UTC-day (inclusive)
|
|
210
210
|
* @param {string} [params.endDate] - ISO-8601 date or timestamp; normalized to end-of-UTC-day (inclusive). Hourly resolution is not supported
|
|
211
|
-
* @param {string|string[]} [params.channel] - Filter by channel (tenDLC, tollFree). Opt-outs are A2P-only, so p2p applies no filter. Filters on the stored channel column; a tenDLC selection also includes older opt-outs that have no channel.
|
|
211
|
+
* @param {string|string[]} [params.channel] - Filter by channel (tenDLC, tollFree, shortCode). Opt-outs are A2P-only, so p2p applies no filter. Filters on the stored channel column; a tenDLC selection also includes older opt-outs that have no channel.
|
|
212
212
|
* @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
|
|
213
213
|
* @returns {Promise<Object>} - A promise that resolves to the DNC analytics data (totals, byDate, byPhoneNumber, byCarrier)
|
|
214
214
|
*/
|
|
@@ -235,7 +235,7 @@ export class Messages {
|
|
|
235
235
|
* @param {number} [params.limit] - Number of records per page
|
|
236
236
|
* @param {string} [params.sortField] - Field to sort by
|
|
237
237
|
* @param {string} [params.sortOrder] - Sort direction (asc, desc)
|
|
238
|
-
* @param {string|string[]} [params.channel] - Filter by channel (tenDLC, tollFree). Opt-outs are A2P-only, so p2p applies no filter. Filters on the stored channel column; a tenDLC selection also includes older opt-outs that have no channel.
|
|
238
|
+
* @param {string|string[]} [params.channel] - Filter by channel (tenDLC, tollFree, shortCode). Opt-outs are A2P-only, so p2p applies no filter. Filters on the stored channel column; a tenDLC selection also includes older opt-outs that have no channel.
|
|
239
239
|
* @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
|
|
240
240
|
* @returns {Promise<Object>} - A promise that resolves to the paginated DNC records
|
|
241
241
|
*/
|
|
@@ -260,7 +260,7 @@ export class Messages {
|
|
|
260
260
|
* @async
|
|
261
261
|
* @roles api, admin, developer, billing, user
|
|
262
262
|
* @param {Object} params - The parameters for sending an SMS message
|
|
263
|
-
* @param {string} params.senderPhoneNumber - The phone number to send the message from
|
|
263
|
+
* @param {string} params.senderPhoneNumber - The 5-6 digit Short Code or 10+ digit phone number to send the message from
|
|
264
264
|
* @param {string|string[]} params.recipientPhoneNumbers - The phone number(s) to send the message to
|
|
265
265
|
* @param {string} params.messageBody - The body of the SMS message
|
|
266
266
|
* @param {string} [params.statusCallbackUrl] - The URL to receive status callbacks
|
|
@@ -341,7 +341,7 @@ export class Messages {
|
|
|
341
341
|
* @async
|
|
342
342
|
* @roles api, admin, developer, billing, user
|
|
343
343
|
* @param {Object} params - The parameters for sending an MMS message
|
|
344
|
-
* @param {string} params.senderPhoneNumber - The phone number to send the message from
|
|
344
|
+
* @param {string} params.senderPhoneNumber - The 5-6 digit Short Code or 10+ digit phone number to send the message from
|
|
345
345
|
* @param {string[]} params.recipientPhoneNumbers - The phone number(s) to send the message to
|
|
346
346
|
* @param {string} params.messageBody - The body of the MMS message
|
|
347
347
|
* @param {string[]} [params.mediaUrls] - The URLs of the media attachments
|
package/src/domains/Voice.js
CHANGED
|
@@ -5,6 +5,7 @@ import { Calls } from "./voice/Calls.js";
|
|
|
5
5
|
import { CallLogs } from "./voice/CallLogs.js";
|
|
6
6
|
import { GlobalVoiceSettings } from "./voice/GlobalVoiceSettings.js";
|
|
7
7
|
import { Tokens } from "./voice/Tokens.js";
|
|
8
|
+
import { Analytics } from "./voice/Analytics.js";
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* Voice domain — wraps the voice-backend service (mounted under /voice on the
|
|
@@ -19,6 +20,7 @@ import { Tokens } from "./voice/Tokens.js";
|
|
|
19
20
|
* - `sdk.voice.callLogs` — Account-scoped call history: list/get + presigned recording.
|
|
20
21
|
* - `sdk.voice.globalVoiceSettings` — Account-wide voice defaults (accepted regions, max spend, E911).
|
|
21
22
|
* - `sdk.voice.tokens` — Mint ephemeral SIP credentials for the browser voice SDK.
|
|
23
|
+
* - `sdk.voice.analytics` — Aggregated call analytics (summary tiles + byDate/byNumber/byCarrier breakdowns).
|
|
22
24
|
*/
|
|
23
25
|
export class Voice {
|
|
24
26
|
constructor(client, enableAdmin) {
|
|
@@ -31,5 +33,6 @@ export class Voice {
|
|
|
31
33
|
this.callLogs = new CallLogs(client, enableAdmin);
|
|
32
34
|
this.globalVoiceSettings = new GlobalVoiceSettings(client, enableAdmin);
|
|
33
35
|
this.tokens = new Tokens(client, enableAdmin);
|
|
36
|
+
this.analytics = new Analytics(client, enableAdmin);
|
|
34
37
|
}
|
|
35
38
|
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {Object} VoiceAnalyticsFilters
|
|
3
|
+
* @property {string} [dateFrom] - ISO-8601 lower bound on call start time.
|
|
4
|
+
* @property {string} [dateTo] - ISO-8601 upper bound on call start time.
|
|
5
|
+
* @property {"day"|"week"|"month"} [groupBy] - Bucket size for the byDate breakdown (default "day").
|
|
6
|
+
* @property {"INBOUND"|"OUTBOUND"} [direction] - Restrict the breakdowns to one direction. Summary tiles always cover both.
|
|
7
|
+
* @property {string} [callSource] - Comma-separated CallLog.callSource list (SIP_TRUNK, PROGRAMMABLE_VOICE, AI_VOICE, WEBRTC, VOICEMAIL, CONFERENCE, PSTN).
|
|
8
|
+
* @property {string} [subgroupId] - Filter by owning subgroup.
|
|
9
|
+
* @property {string} [number] - Substring match against either leg (from OR to).
|
|
10
|
+
* @property {string} [carrier] - Filter by carrier.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* @typedef {Object} VoiceDirectionSummary
|
|
15
|
+
* @property {number} totalCalls
|
|
16
|
+
* @property {number} successfulCalls
|
|
17
|
+
* @property {number} successRate - Percentage (0–100).
|
|
18
|
+
* @property {number} avgCallsPerDay
|
|
19
|
+
* @property {number|null} avgCallDurationSeconds
|
|
20
|
+
* @property {number} totalCallMinutes
|
|
21
|
+
* @property {number} answerRate - Percentage (ASR / answer seizure rate).
|
|
22
|
+
* @property {number} abandonmentRate - Percentage (CANCELED before answer).
|
|
23
|
+
* @property {number} failedCalls
|
|
24
|
+
* @property {number} failureRate - Percentage.
|
|
25
|
+
* @property {number} pctUnder6s - Percentage of answered calls under 6 seconds.
|
|
26
|
+
* @property {number|null} avgRingDurationSeconds - Average answer_time − start_time.
|
|
27
|
+
* @property {number|null} sentimentScore - Positive-sentiment percentage.
|
|
28
|
+
* @property {"Positive"|"Negative"|"Neutral"|null} sentimentLabel
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* @typedef {Object} VoiceBreakdownBucket
|
|
33
|
+
* @property {string} key - The date / number / carrier this bucket aggregates.
|
|
34
|
+
* @property {number} total
|
|
35
|
+
* @property {number} completed
|
|
36
|
+
* @property {number} failed
|
|
37
|
+
* @property {number} noAnswer
|
|
38
|
+
* @property {number} busy
|
|
39
|
+
* @property {number} canceled
|
|
40
|
+
* @property {number} inProgress
|
|
41
|
+
* @property {number} totalDurationSeconds
|
|
42
|
+
* @property {number|null} avgSentimentScore
|
|
43
|
+
*/
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Voice Analytics — aggregated call metrics for the portal Voice Analytics view
|
|
47
|
+
* (voice-backend `GET /voice/stats/voice-analytics`). Returns per-direction
|
|
48
|
+
* summary tiles (both directions) plus byDate / byNumber / byCarrier status
|
|
49
|
+
* breakdowns for charts. Distinct from `voice.callLogs`, which is the raw call
|
|
50
|
+
* history. Accessed via `sdk.voice.analytics`.
|
|
51
|
+
*/
|
|
52
|
+
export class Analytics {
|
|
53
|
+
constructor(client, enableAdmin) {
|
|
54
|
+
this.client = client;
|
|
55
|
+
this.enableAdmin = enableAdmin;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Get aggregated voice analytics for the current account.
|
|
60
|
+
* @async
|
|
61
|
+
* @roles api, admin, developer, billing, user
|
|
62
|
+
* @param {Object} [params] - Request parameters.
|
|
63
|
+
* @param {VoiceAnalyticsFilters} [params.filters] - Optional filters. Summary tiles honor every filter except `direction`; breakdowns honor all filters.
|
|
64
|
+
* @param {import('../../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request.
|
|
65
|
+
* @returns {Promise<Object>} `{ success, range, outbound: VoiceDirectionSummary, inbound: VoiceDirectionSummary, byDate: VoiceBreakdownBucket[], byNumber: VoiceBreakdownBucket[], byCarrier: VoiceBreakdownBucket[], byChannel: VoiceBreakdownBucket[] }` (byChannel = per-callSource breakdown).
|
|
66
|
+
*/
|
|
67
|
+
async get({ filters = {}, options = {} } = {}) {
|
|
68
|
+
const query = new URLSearchParams();
|
|
69
|
+
for (const [k, v] of Object.entries(filters)) {
|
|
70
|
+
if (v !== undefined && v !== null && v !== "") query.set(k, String(v));
|
|
71
|
+
}
|
|
72
|
+
const qs = query.toString();
|
|
73
|
+
const path = qs ? `/voice/stats/voice-analytics?${qs}` : `/voice/stats/voice-analytics`;
|
|
74
|
+
return this.client(path, { method: "GET", ...options });
|
|
75
|
+
}
|
|
76
|
+
}
|
|
@@ -147,44 +147,50 @@ export class SipProfiles {
|
|
|
147
147
|
}
|
|
148
148
|
|
|
149
149
|
/**
|
|
150
|
-
* Assign a phone number to this SIP profile
|
|
151
|
-
* number to the endpoint)
|
|
150
|
+
* Assign a phone number to this SIP profile — routes inbound calls on that
|
|
151
|
+
* number to the endpoint. Prefer `e164` (numbers are Mongo-authoritative); the
|
|
152
|
+
* legacy `phoneNumberId` (a voice-backend phone-number UUID) is still accepted.
|
|
152
153
|
* @async
|
|
153
154
|
* @roles api, admin, developer, billing, user
|
|
154
155
|
* @param {Object} params - Request parameters.
|
|
155
156
|
* @param {string} params.id - The SIP profile UUID.
|
|
156
|
-
* @param {string} params.
|
|
157
|
+
* @param {string} [params.e164] - The phone number in E.164 to assign (preferred).
|
|
158
|
+
* @param {string} [params.phoneNumberId] - Legacy: a voice-backend phone number UUID.
|
|
157
159
|
* @param {import('../../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request.
|
|
158
|
-
* @throws {Error} If id or phoneNumberId is
|
|
160
|
+
* @throws {Error} If id is missing, or neither e164 nor phoneNumberId is provided.
|
|
159
161
|
* @returns {Promise<Object>} `{ sipProfile: {...} }`.
|
|
160
162
|
*/
|
|
161
|
-
async assignNumber({ id, phoneNumberId, options = {} }) {
|
|
162
|
-
this.client._require({ id
|
|
163
|
+
async assignNumber({ id, e164, phoneNumberId, options = {} }) {
|
|
164
|
+
this.client._require({ id });
|
|
165
|
+
if (!e164 && !phoneNumberId) this.client._require({ e164 });
|
|
163
166
|
const safeId = encodeURIComponent(id);
|
|
164
167
|
return this.client(`/voice/sip-profiles/${safeId}/assign-number`, {
|
|
165
168
|
method: "POST",
|
|
166
|
-
body: { phoneNumberId },
|
|
169
|
+
body: e164 ? { e164 } : { phoneNumberId },
|
|
167
170
|
...options,
|
|
168
171
|
});
|
|
169
172
|
}
|
|
170
173
|
|
|
171
174
|
/**
|
|
172
|
-
* Unassign a phone number from this SIP profile.
|
|
175
|
+
* Unassign a phone number from this SIP profile. Prefer `e164`; the legacy
|
|
176
|
+
* `phoneNumberId` (a voice-backend phone-number UUID) is still accepted.
|
|
173
177
|
* @async
|
|
174
178
|
* @roles api, admin, developer, billing, user
|
|
175
179
|
* @param {Object} params - Request parameters.
|
|
176
180
|
* @param {string} params.id - The SIP profile UUID.
|
|
177
|
-
* @param {string} params.
|
|
181
|
+
* @param {string} [params.e164] - The phone number in E.164 to unassign (preferred).
|
|
182
|
+
* @param {string} [params.phoneNumberId] - Legacy: a voice-backend phone number UUID.
|
|
178
183
|
* @param {import('../../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request.
|
|
179
|
-
* @throws {Error} If id or phoneNumberId is
|
|
184
|
+
* @throws {Error} If id is missing, or neither e164 nor phoneNumberId is provided.
|
|
180
185
|
* @returns {Promise<Object>} `{ sipProfile: {...} }`.
|
|
181
186
|
*/
|
|
182
|
-
async unassignNumber({ id, phoneNumberId, options = {} }) {
|
|
183
|
-
this.client._require({ id
|
|
187
|
+
async unassignNumber({ id, e164, phoneNumberId, options = {} }) {
|
|
188
|
+
this.client._require({ id });
|
|
189
|
+
if (!e164 && !phoneNumberId) this.client._require({ e164 });
|
|
184
190
|
const safeId = encodeURIComponent(id);
|
|
185
191
|
return this.client(`/voice/sip-profiles/${safeId}/unassign-number`, {
|
|
186
192
|
method: "POST",
|
|
187
|
-
body: { phoneNumberId },
|
|
193
|
+
body: e164 ? { e164 } : { phoneNumberId },
|
|
188
194
|
...options,
|
|
189
195
|
});
|
|
190
196
|
}
|