@unboundcx/sdk 2.2.4 → 2.2.6

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unboundcx/sdk",
3
- "version": "2.2.4",
3
+ "version": "2.2.6",
4
4
  "description": "Official JavaScript SDK for the Unbound API - A comprehensive toolkit for integrating with Unbound's communication, AI, and data management services",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -207,7 +207,7 @@ export class PhoneNumbersService {
207
207
  );
208
208
 
209
209
  const result = await this.sdk._fetch('/phoneNumbers/porting/portability-check', 'POST', {
210
- phoneNumbers
210
+ body: { phoneNumbers }
211
211
  });
212
212
  return result;
213
213
  }
@@ -220,11 +220,8 @@ export class PhoneNumbersService {
220
220
  activationSettings,
221
221
  webhookUrl,
222
222
  ...additionalData
223
- }) {
224
- if (!phoneNumbers && !phoneNumberBlocks) {
225
- throw new Error('Either phoneNumbers or phoneNumberBlocks is required');
226
- }
227
-
223
+ } = {}) {
224
+ // No validation - creates draft order that can be built incrementally
228
225
  const body = {
229
226
  ...additionalData
230
227
  };
@@ -236,7 +233,9 @@ export class PhoneNumbersService {
236
233
  if (activationSettings) body.activationSettings = activationSettings;
237
234
  if (webhookUrl) body.webhookUrl = webhookUrl;
238
235
 
239
- const result = await this.sdk._fetch('/phoneNumbers/porting/orders', 'POST', body);
236
+ const result = await this.sdk._fetch('/phoneNumbers/porting/orders', 'POST', {
237
+ body: body
238
+ });
240
239
  return result;
241
240
  }
242
241
 
@@ -291,7 +290,29 @@ export class PhoneNumbersService {
291
290
  },
292
291
  );
293
292
 
294
- const result = await this.sdk._fetch(`/phoneNumbers/porting/orders/${id}`, 'PATCH', updateData);
293
+ const result = await this.sdk._fetch(`/phoneNumbers/porting/orders/${id}`, 'PUT', {
294
+ body: updateData
295
+ });
296
+ return result;
297
+ }
298
+
299
+ async submitPortingOrder(id, submissionData = {}) {
300
+ this.sdk.validateParams(
301
+ { id },
302
+ {
303
+ id: { type: 'string', required: true },
304
+ },
305
+ );
306
+
307
+ // Add the submit status to trigger validation and Telnyx submission
308
+ const body = {
309
+ ...submissionData,
310
+ status: 'submit'
311
+ };
312
+
313
+ const result = await this.sdk._fetch(`/phoneNumbers/porting/orders/${id}`, 'PUT', {
314
+ body: body
315
+ });
295
316
  return result;
296
317
  }
297
318
 
@@ -319,7 +340,9 @@ export class PhoneNumbersService {
319
340
 
320
341
  if (portingOrderId) body.portingOrderId = portingOrderId;
321
342
 
322
- const result = await this.sdk._fetch('/phoneNumbers/porting/documents', 'POST', body);
343
+ const result = await this.sdk._fetch('/phoneNumbers/porting/documents', 'POST', {
344
+ body: body
345
+ });
323
346
  return result;
324
347
  }
325
348