@signalhousellc/sdk 1.0.61 → 1.0.63

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.
@@ -1,400 +1,479 @@
1
1
  export class Numbers {
2
- constructor(client, enableAdmin) {
3
- this.client = client;
4
- this.enableAdmin = enableAdmin;
2
+ constructor(client, multipartClient, enableAdmin) {
3
+ this.client = client;
4
+ this.multipartClient = multipartClient;
5
+ this.enableAdmin = enableAdmin;
5
6
 
6
- if (enableAdmin) {
7
- this.admin = {
8
- /**
9
- * Update a port-in request's status (signalhouse only)
10
- * @async
11
- * @roles signalhouse
12
- * @param {Object} params - The parameters for updating the status
13
- * @param {string} params.portingId - The _id of the port-in request
14
- * @param {string} params.status - The new status (PENDING, IN_PROGRESS, REJECTED)
15
- * @param {string} [params.description] - Optional description for the status change
16
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
17
- * @returns {Promise<Object>} A promise that resolves to the updated port-in request
18
- */
19
- changePortingStatus: async ({ portingId, status, description, options = {} }) => {
20
- this.client._require({ portingId, status });
21
- const safeId = encodeURIComponent(portingId);
22
- return this.client(`/number/portin/${safeId}/status`, {
23
- method: "PUT",
24
- body: { status, description },
25
- ...options,
26
- });
27
- },
7
+ if (enableAdmin) {
8
+ this.admin = {
9
+ /**
10
+ * Update a port-in request's status (signalhouse only)
11
+ * @async
12
+ * @roles signalhouse
13
+ * @param {Object} params - The parameters for updating the status
14
+ * @param {string} params.portingId - The _id of the port-in request
15
+ * @param {string} params.status - The new status (PENDING, IN_PROGRESS, REJECTED)
16
+ * @param {string} [params.description] - Optional description for the status change
17
+ * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
18
+ * @returns {Promise<Object>} A promise that resolves to the updated port-in request
19
+ */
20
+ changePortingStatus: async ({ portingId, status, description, options = {} }) => {
21
+ this.client._require({ portingId, status });
22
+ const safeId = encodeURIComponent(portingId);
23
+ return this.client(`/number/portin/${safeId}/status`, {
24
+ method: 'PUT',
25
+ body: { status, description },
26
+ ...options,
27
+ });
28
+ },
28
29
 
29
- /**
30
- * Approve a port-in request, setting its status to SUCCESS (signalhouse only)
31
- * @async
32
- * @roles signalhouse
33
- * @param {Object} params - The parameters for approving the request
34
- * @param {string} params.portingId - The _id of the port-in request
35
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
36
- * @returns {Promise<Object>} A promise that resolves to the updated port-in request
37
- */
38
- approvePortRequest: async ({ portingId, options = {} }) => {
39
- this.client._require({ portingId });
40
- const safeId = encodeURIComponent(portingId);
41
- return this.client(`/number/portin/${safeId}/approve`, {
42
- method: "POST",
43
- ...options,
44
- });
45
- },
46
- };
47
- }
48
- }
30
+ /**
31
+ * Approve a port-in request, setting its status to SUCCESS (signalhouse only)
32
+ * @async
33
+ * @roles signalhouse
34
+ * @param {Object} params - The parameters for approving the request
35
+ * @param {string} params.portingId - The _id of the port-in request
36
+ * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
37
+ * @returns {Promise<Object>} A promise that resolves to the updated port-in request
38
+ */
39
+ approvePortRequest: async ({ portingId, options = {} }) => {
40
+ this.client._require({ portingId });
41
+ const safeId = encodeURIComponent(portingId);
42
+ return this.client(`/number/portin/${safeId}/approve`, {
43
+ method: 'POST',
44
+ ...options,
45
+ });
46
+ },
47
+ /**
48
+ * List campaign-bound Short Code acquisition requests for staff.
49
+ * @async
50
+ * @roles signalhouse
51
+ * @param {Object} [params] - Queue filter parameters.
52
+ * @param {string} [params.status] - PENDING, FULFILLED, or CANCELLED.
53
+ * @param {string} [params.search] - Request or associated identifier search.
54
+ * @param {number} [params.page] - One-based page number.
55
+ * @param {number} [params.limit] - Page size.
56
+ * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options.
57
+ * @returns {Promise<Object>} Paginated acquisition requests.
58
+ */
59
+ getShortCodeAcquisitionRequests: async ({ status, search, page, limit, options = {} } = {}) => {
60
+ const queryString = this.client._getQueryString({ status, search, page, limit });
61
+ return this.client(`/number/short-code/requests${queryString}`, { method: 'GET', ...options });
62
+ },
63
+ };
64
+ }
65
+ }
49
66
 
50
- /**
51
- * Get a list of phone numbers with optional filters such as campaignId, brandId, subgroupId, groupId, and pagination parameters
52
- * @async
53
- * @roles api, admin, developer, billing, user
54
- * @param {Object} params - The parameters for filtering the phone numbers
55
- * @param {string} [params.phoneNumber] - Filter by phone number (partial match)
56
- * @param {string} [params.campaignId] - Filter by campaign ID
57
- * @param {string} [params.brandId] - Filter by brand ID
58
- * @param {string} [params.subgroupId] - Filter by subgroup ID
59
- * @param {string} [params.groupId] - Filter by group ID
60
- * @param {number} [params.page] - The page number for pagination (default: 1)
61
- * @param {number} [params.limit] - The number of items per page for pagination (default: 20)
62
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
63
- * @returns {Promise<Object>} A promise that resolves to the list of phone numbers
64
- */
65
- async getPhoneNumbers({ phoneNumber, campaignId, brandId, subgroupId, groupId, page, limit, options = {} }) {
66
- const filters = { phoneNumber, campaignId, brandId, subgroupId, groupId, page, limit };
67
- const queryString = this.client._getQueryString(filters);
68
- return this.client(`/number${queryString}`, { method: "GET", ...options });
69
- }
67
+ /**
68
+ * Get a list of phone numbers with optional filters such as campaignId, brandId, subgroupId, groupId, and pagination parameters
69
+ * @async
70
+ * @roles api, admin, developer, billing, user
71
+ * @param {Object} params - The parameters for filtering the phone numbers
72
+ * @param {string} [params.phoneNumber] - Filter by phone number (partial match)
73
+ * @param {string} [params.campaignId] - Filter by campaign ID
74
+ * @param {string} [params.brandId] - Filter by brand ID
75
+ * @param {string} [params.subgroupId] - Filter by subgroup ID
76
+ * @param {string} [params.groupId] - Filter by group ID
77
+ * @param {number} [params.page] - The page number for pagination (default: 1)
78
+ * @param {number} [params.limit] - The number of items per page for pagination (default: 20)
79
+ * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
80
+ * @returns {Promise<Object>} A promise that resolves to the list of phone numbers
81
+ */
82
+ async getPhoneNumbers({ phoneNumber, campaignId, brandId, subgroupId, groupId, page, limit, options = {} }) {
83
+ const filters = { phoneNumber, campaignId, brandId, subgroupId, groupId, page, limit };
84
+ const queryString = this.client._getQueryString(filters);
85
+ return this.client(`/number${queryString}`, { method: 'GET', ...options });
86
+ }
70
87
 
71
- /**
72
- * Get the portal-parity health score (1–10) for an owned phone number over 7-day and 30-day windows
73
- * @async
74
- * @roles api, admin, developer, billing, user
75
- * @param {Object} params - The parameters for reading number health
76
- * @param {string} params.phoneNumber - Owned phone number to score (11 digits, no + prefix)
77
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
78
- * @throws {Error} Throws an error if the phoneNumber parameter is missing
79
- * @returns {Promise<Object>} A promise that resolves to `{ phoneNumber, groupId, sevenDay, thirtyDay }`
80
- */
81
- async getNumberHealth({ phoneNumber, options = {} }) {
82
- this.client._require({ phoneNumber });
83
- const queryString = this.client._getQueryString({ phoneNumber });
84
- return this.client(`/number/health${queryString}`, { method: "GET", ...options });
85
- }
88
+ /**
89
+ * Get the portal-parity health score (1–10) for an owned phone number over 7-day and 30-day windows
90
+ * @async
91
+ * @roles api, admin, developer, billing, user
92
+ * @param {Object} params - The parameters for reading number health
93
+ * @param {string} params.phoneNumber - Owned phone number to score (11 digits, no + prefix)
94
+ * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
95
+ * @throws {Error} Throws an error if the phoneNumber parameter is missing
96
+ * @returns {Promise<Object>} A promise that resolves to `{ phoneNumber, groupId, sevenDay, thirtyDay }`
97
+ */
98
+ async getNumberHealth({ phoneNumber, options = {} }) {
99
+ this.client._require({ phoneNumber });
100
+ const queryString = this.client._getQueryString({ phoneNumber });
101
+ return this.client(`/number/health${queryString}`, { method: 'GET', ...options });
102
+ }
86
103
 
87
- /**
88
- * Get a list of available phone numbers for purchase with optional filters
89
- * @async
90
- * @roles api, admin, developer, billing, user
91
- * @param {Object} params - The parameters for filtering the available phone numbers
92
- * @param {boolean} [params.smsEnabled] - Filter for phone numbers that are SMS enabled
93
- * @param {boolean} [params.mmsEnabled] - Filter for phone numbers that are MMS enabled
94
- * @param {boolean} [params.voiceEnabled] - Filter for phone numbers that are voice enabled
95
- * @param {string} [params.country] - Filter by country code (e.g., "US")
96
- * @param {string} [params.state] - Filter by state code (e.g., "CA")
97
- * @param {string} [params.npa] - Filter by NPA (area code)
98
- * @param {string} [params.nxx] - Filter by NXX (central office code) - the first three digits of the local phone number after the area code
99
- * @param {string} [params.phoneNumber] - Filter by phone number
100
- * @param {number} [params.limit] - The number of items per page for pagination
101
- * @param {number} [params.page] - The page number for pagination
102
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
103
- * @returns {Promise<Object>} A promise that resolves to the list of available phone numbers
104
- */
105
- async getAvailablePhoneNumbers({ smsEnabled, mmsEnabled, voiceEnabled, country, state, npa, nxx, phoneNumber, limit, page, options = {} }) {
106
- const filters = { smsEnabled, mmsEnabled, voiceEnabled, country, state, npa, nxx, phoneNumber, limit, page };
107
- const queryString = this.client._getQueryString(filters);
108
- return this.client(`/number/available${queryString}`, { method: "GET", ...options });
109
- }
104
+ /**
105
+ * Get a list of available phone numbers for purchase with optional filters
106
+ * @async
107
+ * @roles api, admin, developer, billing, user
108
+ * @param {Object} params - The parameters for filtering the available phone numbers
109
+ * @param {boolean} [params.smsEnabled] - Filter for phone numbers that are SMS enabled
110
+ * @param {boolean} [params.mmsEnabled] - Filter for phone numbers that are MMS enabled
111
+ * @param {boolean} [params.voiceEnabled] - Filter for phone numbers that are voice enabled
112
+ * @param {string} [params.country] - Filter by country code (e.g., "US")
113
+ * @param {string} [params.state] - Filter by state code (e.g., "CA")
114
+ * @param {string} [params.npa] - Filter by NPA (area code)
115
+ * @param {string} [params.nxx] - Filter by NXX (central office code) - the first three digits of the local phone number after the area code
116
+ * @param {string} [params.phoneNumber] - Filter by phone number
117
+ * @param {number} [params.limit] - The number of items per page for pagination
118
+ * @param {number} [params.page] - The page number for pagination
119
+ * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
120
+ * @returns {Promise<Object>} A promise that resolves to the list of available phone numbers
121
+ */
122
+ async getAvailablePhoneNumbers({
123
+ smsEnabled,
124
+ mmsEnabled,
125
+ voiceEnabled,
126
+ country,
127
+ state,
128
+ npa,
129
+ nxx,
130
+ phoneNumber,
131
+ limit,
132
+ page,
133
+ options = {},
134
+ }) {
135
+ const filters = { smsEnabled, mmsEnabled, voiceEnabled, country, state, npa, nxx, phoneNumber, limit, page };
136
+ const queryString = this.client._getQueryString(filters);
137
+ return this.client(`/number/available${queryString}`, { method: 'GET', ...options });
138
+ }
110
139
 
111
- /**
112
- * Purchase phone numbers by providing a list of phone numbers and the subgroup ID to assign them to.
113
- *
114
- * Each requested number is queued and processed independently. Per-number success or failure is
115
- * delivered via `NUMBER_PURCHASE_SUCCESSFUL` / `NUMBER_PURCHASE_FAILED` webhooks — not in this response.
116
- * @async
117
- * @roles api, admin, developer, billing, user
118
- * @param {Object} params - The parameters for purchasing phone numbers
119
- * @param {string[]} params.phoneNumbers - The list of phone numbers to purchase
120
- * @param {string} params.subgroupId - The ID of the subgroup to assign the purchased phone numbers to
121
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
122
- * @throws {Error} Throws an error if the phoneNumbers or subgroupId parameter is missing
123
- * @returns {Promise<Object>} A promise that resolves to `{ message }` once the request is queued.
124
- */
125
- async purchasePhoneNumber({ phoneNumbers, subgroupId, options = {} }) {
126
- this.client._require({ phoneNumbers, subgroupId });
127
- return this.client(`/number`, { method: "POST", body: { phoneNumbers, subgroupId }, ...options });
128
- }
140
+ /**
141
+ * Purchase phone numbers by providing a list of phone numbers and the subgroup ID to assign them to.
142
+ *
143
+ * Each requested number is queued and processed independently. Per-number success or failure is
144
+ * delivered via `NUMBER_PURCHASE_SUCCESSFUL` / `NUMBER_PURCHASE_FAILED` webhooks — not in this response.
145
+ * @async
146
+ * @roles api, admin, developer, billing, user
147
+ * @param {Object} params - The parameters for purchasing phone numbers
148
+ * @param {string[]} params.phoneNumbers - The list of phone numbers to purchase
149
+ * @param {string} params.subgroupId - The ID of the subgroup to assign the purchased phone numbers to
150
+ * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
151
+ * @throws {Error} Throws an error if the phoneNumbers or subgroupId parameter is missing
152
+ * @returns {Promise<Object>} A promise that resolves to `{ message }` once the request is queued.
153
+ */
154
+ async purchasePhoneNumber({ phoneNumbers, subgroupId, options = {} }) {
155
+ this.client._require({ phoneNumbers, subgroupId });
156
+ return this.client(`/number`, { method: 'POST', body: { phoneNumbers, subgroupId }, ...options });
157
+ }
129
158
 
130
- /**
131
- * Purchase one or more Toll-Free numbers via the asynchronous resource-request flow.
132
- *
133
- * Toll-Free numbers are ordered by quantity (not picked individually) and provisioned asynchronously;
134
- * per-number completion is delivered via webhook/polling, not in this response. The returned `orderId`
135
- * can be polled with {@link Numbers#getTollFreeOrderStatus} for the order's outcome.
136
- * @async
137
- * @roles api, admin, developer, billing, user
138
- * @param {Object} params - The parameters for purchasing toll-free numbers
139
- * @param {number} params.quantity - The number of toll-free numbers to purchase (1-10)
140
- * @param {string} params.subgroupId - The subgroup the purchased numbers are assigned to
141
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
142
- * @throws {Error} Throws an error if the quantity or subgroupId parameter is missing
143
- * @returns {Promise<Object>} A promise that resolves to `{ message, orderId }` once the request is queued.
144
- */
145
- async purchaseTollFreeNumbers({ quantity, subgroupId, options = {} }) {
146
- this.client._require({ quantity, subgroupId });
147
- return this.client(`/number/toll-free`, { method: "POST", body: { quantity, subgroupId }, ...options });
148
- }
159
+ /**
160
+ * Purchase one or more Toll-Free numbers via the asynchronous resource-request flow.
161
+ *
162
+ * Toll-Free numbers are ordered by quantity (not picked individually) and provisioned asynchronously;
163
+ * per-number completion is delivered via webhook/polling, not in this response. The returned `orderId`
164
+ * can be polled with {@link Numbers#getTollFreeOrderStatus} for the order's outcome.
165
+ * @async
166
+ * @roles api, admin, developer, billing, user
167
+ * @param {Object} params - The parameters for purchasing toll-free numbers
168
+ * @param {number} params.quantity - The number of toll-free numbers to purchase (1-10)
169
+ * @param {string} params.subgroupId - The subgroup the purchased numbers are assigned to
170
+ * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
171
+ * @throws {Error} Throws an error if the quantity or subgroupId parameter is missing
172
+ * @returns {Promise<Object>} A promise that resolves to `{ message, orderId }` once the request is queued.
173
+ */
174
+ async purchaseTollFreeNumbers({ quantity, subgroupId, options = {} }) {
175
+ this.client._require({ quantity, subgroupId });
176
+ return this.client(`/number/toll-free`, { method: 'POST', body: { quantity, subgroupId }, ...options });
177
+ }
149
178
 
150
- /**
151
- * Read the outcome of a Toll-Free number purchase by the `orderId` returned from
152
- * {@link Numbers#purchaseTollFreeNumbers}. Reports per-number status as ready / provisioning / failed
153
- * counts (plus failure reasons) so a client can poll until the order reaches a terminal state, and
154
- * returns the provisioned phone numbers for the order so a client can act on exactly those numbers.
155
- * `numbers` is empty until each number is provisioned (it fills in as the order completes).
156
- * @async
157
- * @roles api, admin, developer, billing, user
158
- * @param {Object} params - The parameters for reading the order status
159
- * @param {string} params.orderId - The order id returned by `purchaseTollFreeNumbers`
160
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
161
- * @throws {Error} Throws an error if the orderId parameter is missing
162
- * @returns {Promise<Object>} A promise that resolves to `{ orderId, counts: { ready, provisioning, failed }, failures: [{ reason }], numbers: string[] }`.
163
- */
164
- async getTollFreeOrderStatus({ orderId, options = {} }) {
165
- this.client._require({ orderId });
166
- const safeOrderId = encodeURIComponent(orderId);
167
- return this.client(`/number/toll-free/order/${safeOrderId}`, { method: "GET", ...options });
168
- }
179
+ /**
180
+ * Request a campaign-bound Short Code acquisition or register a customer-owned Registry lease.
181
+ * An inventory request soft-holds an existing unassigned Short Code. Random and vanity requests remain pending
182
+ * until Signal House staff fulfill them. An external lease creates a pending Short Code number immediately; it
183
+ * becomes READY only when its campaign becomes ACTIVE.
184
+ * @async
185
+ * @roles api, admin, developer, billing, user
186
+ * @param {Object} params - Short Code acquisition parameters.
187
+ * @param {string} params.subgroupId - The owning subgroup ID.
188
+ * @param {string} params.brandId - The owning Short Code brand ID.
189
+ * @param {string} params.campaignId - The owning Short Code campaign ID.
190
+ * @param {'INVENTORY'|'RANDOM'|'VANITY'|'EXTERNAL_LEASE'} params.requestType - Acquisition path.
191
+ * @param {string} [params.existingPhoneNumber] - Required existing five- or six-digit Short Code for INVENTORY.
192
+ * @param {number} [params.leaseTermMonths] - Required 3, 6, or 12-month term for RANDOM/VANITY.
193
+ * @param {string} [params.requestedVanityCode] - Required five- or six-digit desired code for VANITY.
194
+ * @param {string} [params.actualCode] - Required customer-owned five- or six-digit code for EXTERNAL_LEASE.
195
+ * @param {string} [params.orderId] - Required Registry order ID for EXTERNAL_LEASE.
196
+ * @param {string|Date} [params.leaseEndDate] - Required future Registry lease end date for EXTERNAL_LEASE.
197
+ * @param {Buffer|Blob|File} [params.leaseReceiptFile] - Required PNG, JPEG, or PDF lease receipt for EXTERNAL_LEASE.
198
+ * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request.
199
+ * @returns {Promise<Object>} A pending acquisition request or pending external-lease number.
200
+ */
201
+ async requestShortCodeAcquisition({
202
+ subgroupId,
203
+ brandId,
204
+ campaignId,
205
+ requestType,
206
+ existingPhoneNumber,
207
+ requestedVanityCode,
208
+ leaseTermMonths,
209
+ actualCode,
210
+ orderId,
211
+ leaseEndDate,
212
+ leaseReceiptFile,
213
+ options = {},
214
+ }) {
215
+ this.client._require({ subgroupId, brandId, campaignId, requestType });
216
+ const formData = new FormData();
217
+ formData.append(
218
+ 'acquisitionData',
219
+ JSON.stringify({ subgroupId, brandId, campaignId, requestType, existingPhoneNumber, requestedVanityCode, leaseTermMonths, actualCode, orderId, leaseEndDate }),
220
+ );
221
+ if (leaseReceiptFile) formData.append('leaseReceipt', leaseReceiptFile);
222
+ return this.multipartClient(`/number/short-code`, {
223
+ method: 'POST',
224
+ body: formData,
225
+ ...options,
226
+ });
227
+ }
169
228
 
170
- /**
171
- * Update an existing phone number's details (e.g., setting a friendly name)
172
- * @async
173
- * @roles api, admin, developer, user
174
- * @param {Object} params - The parameters for updating the phone number
175
- * @param {string} params.phoneNumber - The phone number to update
176
- * @param {Object} params.updateData - The data to update for the phone number
177
- * @param {string} [params.updateData.friendlyName] - An optional friendly name for the phone number
178
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
179
- * @throws {Error} Throws an error if the phoneNumber or updateData parameter is missing
180
- * @returns {Promise<Object>} A promise that resolves to the updated phone number object
181
- */
182
- async updatePhoneNumber({ phoneNumber, updateData, options = {} }) {
183
- this.client._require({ phoneNumber, updateData });
184
-
185
- // Safely encode the phone number for the URL path
186
- const safePhoneNumber = encodeURIComponent(phoneNumber);
187
-
188
- return this.client(`/number/${safePhoneNumber}`, {
189
- method: "PUT",
190
- body: updateData,
191
- ...options
192
- });
193
- }
194
-
195
- /**
196
- * Submit a port-in request for one or more phone numbers from another provider
197
- * @async
198
- * @roles api, admin, developer, billing, user
199
- * @param {Object} params - The parameters for the port-in request
200
- * @param {Object} params.numberData - The port-in request data including owner info, address, phone numbers, and signature
201
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
202
- * @throws {Error} Throws an error if the numberData parameter is missing
203
- * @returns {Promise<Object>} A promise that resolves to the created port-in request
204
- */
205
- async portInPhoneNumber({ numberData, options = {} }) {
206
- this.client._require({ numberData });
207
- return this.client(`/number/portin`, { method: "POST", body: numberData, ...options });
208
- }
229
+ /**
230
+ * Read the outcome of a Toll-Free number purchase by the `orderId` returned from
231
+ * {@link Numbers#purchaseTollFreeNumbers}. Reports per-number status as ready / provisioning / failed
232
+ * counts (plus failure reasons) so a client can poll until the order reaches a terminal state, and
233
+ * returns the provisioned phone numbers for the order so a client can act on exactly those numbers.
234
+ * `numbers` is empty until each number is provisioned (it fills in as the order completes).
235
+ * @async
236
+ * @roles api, admin, developer, billing, user
237
+ * @param {Object} params - The parameters for reading the order status
238
+ * @param {string} params.orderId - The order id returned by `purchaseTollFreeNumbers`
239
+ * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
240
+ * @throws {Error} Throws an error if the orderId parameter is missing
241
+ * @returns {Promise<Object>} A promise that resolves to `{ orderId, counts: { ready, provisioning, failed }, failures: [{ reason }], numbers: string[] }`.
242
+ */
243
+ async getTollFreeOrderStatus({ orderId, options = {} }) {
244
+ this.client._require({ orderId });
245
+ const safeOrderId = encodeURIComponent(orderId);
246
+ return this.client(`/number/toll-free/order/${safeOrderId}`, { method: 'GET', ...options });
247
+ }
209
248
 
210
- /**
211
- * Get port-in requests with optional filters. Signal House staff can view all requests; regular users see only their group's requests.
212
- * @async
213
- * @roles api, admin, developer, billing, user
214
- * @param {Object} [params] - The parameters for filtering port-in requests
215
- * @param {string} [params.groupId] - Filter by group ID
216
- * @param {string} [params.phoneNumber] - Filter by phone number
217
- * @param {string} [params.status] - Filter by status (PENDING, IN_PROGRESS, COMPLETED, REJECTED, CANCELLED)
218
- * @param {number} [params.page] - The page number for pagination (default: 1)
219
- * @param {number} [params.limit] - The number of items per page (default: 20)
220
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
221
- * @returns {Promise<Object>} A promise that resolves to the paginated list of port-in requests
222
- */
223
- async getPortRequests({ groupId, phoneNumber, status, page, limit, options = {} } = {}) {
224
- const filters = { groupId, phoneNumber, status, page, limit };
225
- const queryString = this.client._getQueryString(filters);
226
- return this.client(`/number/portin${queryString}`, { method: "GET", ...options });
227
- }
249
+ /**
250
+ * Update an existing phone number's details (e.g., setting a friendly name)
251
+ * @async
252
+ * @roles api, admin, developer, user
253
+ * @param {Object} params - The parameters for updating the phone number
254
+ * @param {string} params.phoneNumber - The phone number to update
255
+ * @param {Object} params.updateData - The data to update for the phone number
256
+ * @param {string} [params.updateData.friendlyName] - An optional friendly name for the phone number
257
+ * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
258
+ * @throws {Error} Throws an error if the phoneNumber or updateData parameter is missing
259
+ * @returns {Promise<Object>} A promise that resolves to the updated phone number object
260
+ */
261
+ async updatePhoneNumber({ phoneNumber, updateData, options = {} }) {
262
+ this.client._require({ phoneNumber, updateData });
228
263
 
229
- /**
230
- * Get a single port-in request by its ID
231
- * @async
232
- * @roles api, admin, developer, billing, user
233
- * @param {Object} params - The parameters for getting the port request
234
- * @param {string} params.id - The _id of the port-in request
235
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
236
- * @returns {Promise<Object>} A promise that resolves to the port-in request object
237
- */
238
- async getPortRequestById({ id, options = {} }) {
239
- this.client._require({ id });
240
- const safeId = encodeURIComponent(id);
241
- return this.client(`/number/portin/${safeId}`, { method: "GET", ...options });
242
- }
264
+ // Safely encode the phone number for the URL path
265
+ const safePhoneNumber = encodeURIComponent(phoneNumber);
243
266
 
244
- /**
245
- * Get porting requests - fetches a single request by portingId, or delegates to getPortRequests for listing
246
- * @async
247
- * @roles api, admin, developer, billing, user
248
- * @param {Object} params - The parameters
249
- * @param {string} [params.portingId] - If provided, fetches a single port request by ID
250
- * @param {number} [params.page] - Page number for pagination (used when listing)
251
- * @param {number} [params.limit] - Items per page (used when listing)
252
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
253
- * @returns {Promise<Object>} A promise that resolves to the port-in request(s)
254
- */
255
- async getPortingRequests({ portingId, page, limit, options = {} } = {}) {
256
- if (portingId) {
257
- return this.getPortRequestById({ id: portingId, options });
258
- }
259
- return this.getPortRequests({ page, limit, options });
260
- }
267
+ return this.client(`/number/${safePhoneNumber}`, {
268
+ method: 'PUT',
269
+ body: updateData,
270
+ ...options,
271
+ });
272
+ }
261
273
 
262
- /**
263
- * Assign phone numbers to a campaign by providing the campaign ID and a list of phone numbers to assign
264
- * @async
265
- * @roles api, admin, developer, billing, user
266
- * @param {Object} params - The parameters for assigning phone numbers to a campaign
267
- * @param {string} params.campaignId - The ID of the campaign to assign phone numbers to
268
- * @param {string[]} params.phoneNumbers - The list of phone numbers to assign to the campaign
269
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
270
- * @throws {Error} Throws an error if the campaignId or phoneNumbers parameter is missing
271
- * @returns {Promise<Object>} A promise that resolves to the result of the assignment operation
272
- */
273
- async assignPhoneNumberToCampaign({ campaignId, phoneNumbers, options = {} }) {
274
- this.client._require({ campaignId, phoneNumbers });
275
- const safeCampaignId = encodeURIComponent(campaignId);
276
- return this.client(`/number/assign/${safeCampaignId}`, { method: "POST", body: { phoneNumbers }, ...options });
277
- }
274
+ /**
275
+ * Submit a port-in request for one or more phone numbers from another provider
276
+ * @async
277
+ * @roles api, admin, developer, billing, user
278
+ * @param {Object} params - The parameters for the port-in request
279
+ * @param {Object} params.numberData - The port-in request data including owner info, address, phone numbers, and signature
280
+ * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
281
+ * @throws {Error} Throws an error if the numberData parameter is missing
282
+ * @returns {Promise<Object>} A promise that resolves to the created port-in request
283
+ */
284
+ async portInPhoneNumber({ numberData, options = {} }) {
285
+ this.client._require({ numberData });
286
+ return this.client(`/number/portin`, { method: 'POST', body: numberData, ...options });
287
+ }
278
288
 
279
- /**
280
- * Unassign phone numbers from a campaign by providing a list of phone numbers to unassign. Note: This operation will unassign the specified phone numbers from any campaign they are currently assigned to.
281
- * @async
282
- * @roles api, admin, developer, billing, user
283
- * @param {Object} params - The parameters for unassigning phone numbers from campaigns
284
- * @param {string[]} params.phoneNumbers - The list of phone numbers to unassign from campaigns
285
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
286
- * @throws {Error} Throws an error if the phoneNumbers parameter is missing
287
- * @returns {Promise<Object>} A promise that resolves to the result of the unassignment operation
288
- */
289
- async unassignPhoneNumbersFromCampaigns({ phoneNumbers, options = {} }) {
290
- this.client._require({ phoneNumbers });
291
- return this.client(`/number/unassign`, { method: "POST", body: { phoneNumbers }, ...options });
292
- }
289
+ /**
290
+ * Get port-in requests with optional filters. Signal House staff can view all requests; regular users see only their group's requests.
291
+ * @async
292
+ * @roles api, admin, developer, billing, user
293
+ * @param {Object} [params] - The parameters for filtering port-in requests
294
+ * @param {string} [params.groupId] - Filter by group ID
295
+ * @param {string} [params.phoneNumber] - Filter by phone number
296
+ * @param {string} [params.status] - Filter by status (PENDING, IN_PROGRESS, COMPLETED, REJECTED, CANCELLED)
297
+ * @param {number} [params.page] - The page number for pagination (default: 1)
298
+ * @param {number} [params.limit] - The number of items per page (default: 20)
299
+ * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
300
+ * @returns {Promise<Object>} A promise that resolves to the paginated list of port-in requests
301
+ */
302
+ async getPortRequests({ groupId, phoneNumber, status, page, limit, options = {} } = {}) {
303
+ const filters = { groupId, phoneNumber, status, page, limit };
304
+ const queryString = this.client._getQueryString(filters);
305
+ return this.client(`/number/portin${queryString}`, { method: 'GET', ...options });
306
+ }
293
307
 
294
- /**
295
- * Delete a list of phone numbers (mark them as RELEASED). The phone numbers will no longer be active or usable but they will still be visible in the system with a status of "RELEASED". Note: This operation is irreversible and should be used with caution.
296
- * @async
297
- * @roles api, admin, developer, billing, user
298
- * @param {Object} params - The parameters for deleting phone numbers
299
- * @param {string[]} params.phoneNumbers - The list of phone numbers to delete
300
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
301
- * @throws {Error} Throws an error if the phoneNumbers parameter is missing
302
- * @returns {Promise<Object>} A promise that resolves to the result of the deletion operation
303
- */
304
- async deletePhoneNumbers({ phoneNumbers, options = {} }) {
305
- this.client._require({ phoneNumbers });
306
- return this.client(`/number`, { method: "DELETE", body: { phoneNumbers }, ...options });
307
- }
308
+ /**
309
+ * Get a single port-in request by its ID
310
+ * @async
311
+ * @roles api, admin, developer, billing, user
312
+ * @param {Object} params - The parameters for getting the port request
313
+ * @param {string} params.id - The _id of the port-in request
314
+ * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
315
+ * @returns {Promise<Object>} A promise that resolves to the port-in request object
316
+ */
317
+ async getPortRequestById({ id, options = {} }) {
318
+ this.client._require({ id });
319
+ const safeId = encodeURIComponent(id);
320
+ return this.client(`/number/portin/${safeId}`, { method: 'GET', ...options });
321
+ }
308
322
 
309
- /**
310
- * Deactivate one or more phone numbers. Numbers must be in READY status to be deactivated. Deactivated numbers will not be able to send or receive messages but will remain assigned to their subgroup and campaign.
311
- * @async
312
- * @roles api, admin, developer, billing, user
313
- * @param {Object} params - The parameters for deactivating phone numbers
314
- * @param {string[]} params.phoneNumbers - The list of phone numbers to deactivate
315
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
316
- * @throws {Error} Throws an error if the phoneNumbers parameter is missing
317
- * @returns {Promise<Object>} A promise that resolves to an array of updated phone number objects
318
- */
319
- async deactivatePhoneNumbers({ phoneNumbers, options = {} }) {
320
- this.client._require({ phoneNumbers });
321
- return this.client(`/number/deactivate`, { method: "POST", body: { phoneNumbers }, ...options });
322
- }
323
+ /**
324
+ * Get porting requests - fetches a single request by portingId, or delegates to getPortRequests for listing
325
+ * @async
326
+ * @roles api, admin, developer, billing, user
327
+ * @param {Object} params - The parameters
328
+ * @param {string} [params.portingId] - If provided, fetches a single port request by ID
329
+ * @param {number} [params.page] - Page number for pagination (used when listing)
330
+ * @param {number} [params.limit] - Items per page (used when listing)
331
+ * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
332
+ * @returns {Promise<Object>} A promise that resolves to the port-in request(s)
333
+ */
334
+ async getPortingRequests({ portingId, page, limit, options = {} } = {}) {
335
+ if (portingId) {
336
+ return this.getPortRequestById({ id: portingId, options });
337
+ }
338
+ return this.getPortRequests({ page, limit, options });
339
+ }
323
340
 
324
- /**
325
- * Reactivate one or more previously deactivated phone numbers. Numbers must be in DEACTIVATED status to be reactivated. Reactivated numbers will return to PENDING or IN_PROGRESS status depending on their campaign assignment.
326
- * @async
327
- * @roles api, admin, developer, billing, user
328
- * @param {Object} params - The parameters for reactivating phone numbers
329
- * @param {string[]} params.phoneNumbers - The list of phone numbers to reactivate
330
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
331
- * @throws {Error} Throws an error if the phoneNumbers parameter is missing
332
- * @returns {Promise<Object>} A promise that resolves to an array of updated phone number objects
333
- */
334
- async reactivatePhoneNumbers({ phoneNumbers, options = {} }) {
335
- this.client._require({ phoneNumbers });
336
- return this.client(`/number/reactivate`, { method: "POST", body: { phoneNumbers }, ...options });
337
- }
341
+ /**
342
+ * Assign phone numbers to a campaign by providing the campaign ID and a list of phone numbers to assign
343
+ * @async
344
+ * @roles api, admin, developer, billing, user
345
+ * @param {Object} params - The parameters for assigning phone numbers to a campaign
346
+ * @param {string} params.campaignId - The ID of the campaign to assign phone numbers to
347
+ * @param {string[]} params.phoneNumbers - The list of phone numbers to assign to the campaign
348
+ * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
349
+ * @throws {Error} Throws an error if the campaignId or phoneNumbers parameter is missing
350
+ * @returns {Promise<Object>} A promise that resolves to the result of the assignment operation
351
+ */
352
+ async assignPhoneNumberToCampaign({ campaignId, phoneNumbers, options = {} }) {
353
+ this.client._require({ campaignId, phoneNumbers });
354
+ const safeCampaignId = encodeURIComponent(campaignId);
355
+ return this.client(`/number/assign/${safeCampaignId}`, { method: 'POST', body: { phoneNumbers }, ...options });
356
+ }
338
357
 
339
- /**
340
- * Transfer unassigned phone numbers from one subgroup to another.
341
- * @async
342
- * @param {Object} params - The parameters for transferring phone numbers
343
- * @param {string[]} params.phoneNumbers - The list of phone numbers to transfer
344
- * @param {string} params.newSubgroupId - The ID of the new subgroup to transfer the phone numbers to
345
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
346
- * @returns {Promise<Object>} A promise that resolves to the result of the transfer operation
347
- */
348
- async transferPhoneNumbers({ phoneNumbers, newSubgroupId, options = {} }) {
349
- this.client._require({ phoneNumbers, newSubgroupId });
350
- return this.client(`/number/transfer`, { method: "POST", body: { phoneNumbers, newSubgroupId }, ...options });
351
- }
358
+ /**
359
+ * Unassign phone numbers from a campaign by providing a list of phone numbers to unassign. Note: This operation will unassign the specified phone numbers from any campaign they are currently assigned to.
360
+ * @async
361
+ * @roles api, admin, developer, billing, user
362
+ * @param {Object} params - The parameters for unassigning phone numbers from campaigns
363
+ * @param {string[]} params.phoneNumbers - The list of phone numbers to unassign from campaigns
364
+ * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
365
+ * @throws {Error} Throws an error if the phoneNumbers parameter is missing
366
+ * @returns {Promise<Object>} A promise that resolves to the result of the unassignment operation
367
+ */
368
+ async unassignPhoneNumbersFromCampaigns({ phoneNumbers, options = {} }) {
369
+ this.client._require({ phoneNumbers });
370
+ return this.client(`/number/unassign`, { method: 'POST', body: { phoneNumbers }, ...options });
371
+ }
352
372
 
353
- /**
354
- * Search NPA/NXX lookup data with optional filters.
355
- * At least one search parameter is required.
356
- * Location filters (country, state, city) cannot be combined with NPA/NXX filters.
357
- * @async
358
- * @roles api, admin, developer, billing, user
359
- * @param {Object} params - The parameters for searching NPA/NXX data
360
- * @param {string} [params.country] - Filter by country code
361
- * @param {string} [params.state] - Filter by state code (2 characters)
362
- * @param {string} [params.city] - Filter by city name (prefix match, case-insensitive; requires country and state)
363
- * @param {string} [params.npa] - Area code filter (1-3 digits; cannot combine with location filters)
364
- * @param {string} [params.nxx] - Central office code filter (1-3 digits; cannot combine with location filters)
365
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
366
- * @returns {Promise<Object>} A promise that resolves to matching NPA/NXX records or unique NPA/NXX arrays
367
- */
368
- async searchNpaNxx({ country, state, city, npa, nxx, options = {} }) {
369
- const queryString = this.client._getQueryString({ country, state, city, npa, nxx });
370
- return this.client(`/number/lookup${queryString}`, { method: "GET", ...options });
371
- }
373
+ /**
374
+ * Delete a list of phone numbers (mark them as RELEASED). The phone numbers will no longer be active or usable but they will still be visible in the system with a status of "RELEASED". Note: This operation is irreversible and should be used with caution.
375
+ * @async
376
+ * @roles api, admin, developer, billing, user
377
+ * @param {Object} params - The parameters for deleting phone numbers
378
+ * @param {string[]} params.phoneNumbers - The list of phone numbers to delete
379
+ * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
380
+ * @throws {Error} Throws an error if the phoneNumbers parameter is missing
381
+ * @returns {Promise<Object>} A promise that resolves to the result of the deletion operation
382
+ */
383
+ async deletePhoneNumbers({ phoneNumbers, options = {} }) {
384
+ this.client._require({ phoneNumbers });
385
+ return this.client(`/number`, { method: 'DELETE', body: { phoneNumbers }, ...options });
386
+ }
372
387
 
373
- /**
374
- * Batch lookup city/state for NPA/NXX pairs
375
- * @async
376
- * @roles api, admin, developer, billing, user
377
- * @param {Object} params - The parameters for the lookup
378
- * @param {Array<{npa: string, nxx: string}>} params.entries - NPA/NXX pairs to look up (max 50)
379
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
380
- * @returns {Promise<Object>} A promise that resolves to an array of {npa, nxx, city, state} objects
381
- */
382
- async lookupLocations({ entries, options = {} }) {
383
- return this.client("/number/lookup/location", { method: "POST", body: { entries }, ...options });
384
- }
388
+ /**
389
+ * Deactivate one or more phone numbers. Numbers must be in READY status to be deactivated. Deactivated numbers will not be able to send or receive messages but will remain assigned to their subgroup and campaign.
390
+ * @async
391
+ * @roles api, admin, developer, billing, user
392
+ * @param {Object} params - The parameters for deactivating phone numbers
393
+ * @param {string[]} params.phoneNumbers - The list of phone numbers to deactivate
394
+ * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
395
+ * @throws {Error} Throws an error if the phoneNumbers parameter is missing
396
+ * @returns {Promise<Object>} A promise that resolves to an array of updated phone number objects
397
+ */
398
+ async deactivatePhoneNumbers({ phoneNumbers, options = {} }) {
399
+ this.client._require({ phoneNumbers });
400
+ return this.client(`/number/deactivate`, { method: 'POST', body: { phoneNumbers }, ...options });
401
+ }
385
402
 
386
- /**
387
- * Migrate a phone number (or all numbers in a campaign/group) from v1 to v2
388
- * @async
389
- * @roles api, admin, developer, billing, user, signalhouse_api, signalhouse_admin, signalhouse_user
390
- * @param {Object} params - The parameters for migration
391
- * @param {string} [params.phoneNumber] - The phone number to migrate
392
- * @param {string} [params.campaignId] - Campaign ID to migrate all numbers for
393
- * @param {string} [params.groupId] - Group ID to migrate all numbers for
394
- * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
395
- * @returns {Promise<Object>} A promise that resolves to a confirmation with count of queued numbers
396
- */
397
- async migratePhoneNumberToV2({ phoneNumber, campaignId, groupId, options = {} }) {
398
- return this.client(`/number/migrate`, { method: "POST", body: { phoneNumber, campaignId, groupId }, ...options });
399
- }
400
- }
403
+ /**
404
+ * Reactivate one or more previously deactivated phone numbers. Numbers must be in DEACTIVATED status to be reactivated. Reactivated numbers will return to PENDING or IN_PROGRESS status depending on their campaign assignment.
405
+ * @async
406
+ * @roles api, admin, developer, billing, user
407
+ * @param {Object} params - The parameters for reactivating phone numbers
408
+ * @param {string[]} params.phoneNumbers - The list of phone numbers to reactivate
409
+ * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
410
+ * @throws {Error} Throws an error if the phoneNumbers parameter is missing
411
+ * @returns {Promise<Object>} A promise that resolves to an array of updated phone number objects
412
+ */
413
+ async reactivatePhoneNumbers({ phoneNumbers, options = {} }) {
414
+ this.client._require({ phoneNumbers });
415
+ return this.client(`/number/reactivate`, { method: 'POST', body: { phoneNumbers }, ...options });
416
+ }
417
+
418
+ /**
419
+ * Transfer unassigned phone numbers from one subgroup to another.
420
+ * @async
421
+ * @param {Object} params - The parameters for transferring phone numbers
422
+ * @param {string[]} params.phoneNumbers - The list of phone numbers to transfer
423
+ * @param {string} params.newSubgroupId - The ID of the new subgroup to transfer the phone numbers to
424
+ * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
425
+ * @returns {Promise<Object>} A promise that resolves to the result of the transfer operation
426
+ */
427
+ async transferPhoneNumbers({ phoneNumbers, newSubgroupId, options = {} }) {
428
+ this.client._require({ phoneNumbers, newSubgroupId });
429
+ return this.client(`/number/transfer`, { method: 'POST', body: { phoneNumbers, newSubgroupId }, ...options });
430
+ }
431
+
432
+ /**
433
+ * Search NPA/NXX lookup data with optional filters.
434
+ * At least one search parameter is required.
435
+ * Location filters (country, state, city) cannot be combined with NPA/NXX filters.
436
+ * @async
437
+ * @roles api, admin, developer, billing, user
438
+ * @param {Object} params - The parameters for searching NPA/NXX data
439
+ * @param {string} [params.country] - Filter by country code
440
+ * @param {string} [params.state] - Filter by state code (2 characters)
441
+ * @param {string} [params.city] - Filter by city name (prefix match, case-insensitive; requires country and state)
442
+ * @param {string} [params.npa] - Area code filter (1-3 digits; cannot combine with location filters)
443
+ * @param {string} [params.nxx] - Central office code filter (1-3 digits; cannot combine with location filters)
444
+ * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
445
+ * @returns {Promise<Object>} A promise that resolves to matching NPA/NXX records or unique NPA/NXX arrays
446
+ */
447
+ async searchNpaNxx({ country, state, city, npa, nxx, options = {} }) {
448
+ const queryString = this.client._getQueryString({ country, state, city, npa, nxx });
449
+ return this.client(`/number/lookup${queryString}`, { method: 'GET', ...options });
450
+ }
451
+
452
+ /**
453
+ * Batch lookup city/state for NPA/NXX pairs
454
+ * @async
455
+ * @roles api, admin, developer, billing, user
456
+ * @param {Object} params - The parameters for the lookup
457
+ * @param {Array<{npa: string, nxx: string}>} params.entries - NPA/NXX pairs to look up (max 50)
458
+ * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
459
+ * @returns {Promise<Object>} A promise that resolves to an array of {npa, nxx, city, state} objects
460
+ */
461
+ async lookupLocations({ entries, options = {} }) {
462
+ return this.client('/number/lookup/location', { method: 'POST', body: { entries }, ...options });
463
+ }
464
+
465
+ /**
466
+ * Migrate a phone number (or all numbers in a campaign/group) from v1 to v2
467
+ * @async
468
+ * @roles api, admin, developer, billing, user, signalhouse_api, signalhouse_admin, signalhouse_user
469
+ * @param {Object} params - The parameters for migration
470
+ * @param {string} [params.phoneNumber] - The phone number to migrate
471
+ * @param {string} [params.campaignId] - Campaign ID to migrate all numbers for
472
+ * @param {string} [params.groupId] - Group ID to migrate all numbers for
473
+ * @param {import('../SignalHouseSDK').RequestOptions} [params.options] - Additional options for the request
474
+ * @returns {Promise<Object>} A promise that resolves to a confirmation with count of queued numbers
475
+ */
476
+ async migratePhoneNumberToV2({ phoneNumber, campaignId, groupId, options = {} }) {
477
+ return this.client(`/number/migrate`, { method: 'POST', body: { phoneNumber, campaignId, groupId }, ...options });
478
+ }
479
+ }