@unboundcx/sdk 2.6.0 → 2.6.2

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.6.0",
3
+ "version": "2.6.2",
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",
@@ -597,6 +597,43 @@ export class PhoneNumbersService {
597
597
  const result = await this.sdk._fetch(url, 'GET');
598
598
  return result;
599
599
  }
600
+
601
+ /**
602
+ * Get available activation dates for a porting order
603
+ * - Creates the porting order in external system if not already created
604
+ * - Updates the order data to ensure it's current before fetching dates
605
+ * - Returns list of available activation dates for user selection
606
+ * - Validates that phone numbers and required order details are complete
607
+ * @param {string} id - Porting order ID
608
+ * @returns {Promise<Object>} Available activation dates and order status
609
+ * @example
610
+ * const dates = await sdk.phoneNumbers.getFocWindows("port_123...");
611
+ * // Returns:
612
+ * // {
613
+ * // id: "port_123...",
614
+ * // status: "draft",
615
+ * // availableDates: [
616
+ * // { date: "2025-08-30T00:00:00.000Z", type: "Standard", available: true },
617
+ * // { date: "2025-09-02T00:00:00.000Z", type: "Express", available: true }
618
+ * // ],
619
+ * // phoneNumbersCount: 1,
620
+ * // orderReady: true
621
+ * // }
622
+ */
623
+ async getFocWindows(id) {
624
+ this.sdk.validateParams(
625
+ { id },
626
+ {
627
+ id: { type: 'string', required: true },
628
+ },
629
+ );
630
+
631
+ const result = await this.sdk._fetch(
632
+ `/phoneNumbers/porting/orders/${id}/foc-windows`,
633
+ 'GET'
634
+ );
635
+ return result;
636
+ }
600
637
  }
601
638
 
602
639
  export class PhoneNumberCarrierService {
@@ -495,4 +495,31 @@ export class StorageService {
495
495
  const result = await this.sdk._fetch('/storage/files', 'GET', params);
496
496
  return result;
497
497
  }
498
+
499
+ /**
500
+ * Generate an access key for an existing storage file
501
+ * @param {string} fileId - The storage file ID
502
+ * @param {number} expiresIn - Access key expiration time in seconds (default: 1800 = 30 minutes)
503
+ * @returns {Promise<Object>} Object containing access key, URL, and expiration info
504
+ */
505
+ async generateAccessKey(fileId, expiresIn = 1800) {
506
+ this.sdk.validateParams(
507
+ { fileId, expiresIn },
508
+ {
509
+ fileId: { type: 'string', required: true },
510
+ expiresIn: { type: 'number', required: false },
511
+ },
512
+ );
513
+
514
+ const params = {
515
+ body: { expiresIn },
516
+ };
517
+
518
+ const result = await this.sdk._fetch(
519
+ `/storage/${fileId}/accessKey`,
520
+ 'POST',
521
+ params,
522
+ );
523
+ return result;
524
+ }
498
525
  }