@unboundcx/sdk 2.6.6 → 2.6.7

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.6",
3
+ "version": "2.6.7",
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",
@@ -654,6 +654,113 @@ export class PhoneNumbersService {
654
654
  );
655
655
  return result;
656
656
  }
657
+
658
+ /**
659
+ * Sync a porting order with the carrier
660
+ * Fetches the latest order details and comments from the carrier and updates the local database
661
+ * @param {string} id - Porting order ID
662
+ * @returns {Promise<Object>} Sync results including updates made and comments added
663
+ * @example
664
+ * const syncResult = await sdk.phoneNumbers.syncPortingOrder("port_123...");
665
+ * // Returns:
666
+ * // {
667
+ * // id: "port_123...",
668
+ * // carrierOrderId: "carrier_abc123",
669
+ * // orderUpdated: true,
670
+ * // commentsAdded: 2,
671
+ * // errors: []
672
+ * // }
673
+ */
674
+ async syncPortingOrder(id) {
675
+ this.sdk.validateParams(
676
+ { id },
677
+ {
678
+ id: { type: 'string', required: true },
679
+ },
680
+ );
681
+
682
+ const result = await this.sdk._fetch(
683
+ `/phoneNumbers/porting/orders/${id}/sync`,
684
+ 'POST',
685
+ );
686
+ return result;
687
+ }
688
+
689
+ /**
690
+ * Get comments for a porting order
691
+ * @param {string} id - Porting order ID
692
+ * @param {Object} [options] - Query options
693
+ * @param {string} [options.includeInternal='true'] - Include internal comments ('true', 'false', 'only')
694
+ * @returns {Promise<Object>} Comments list with metadata
695
+ * @example
696
+ * // Get all comments
697
+ * const allComments = await sdk.phoneNumbers.getPortingComments("port_123...");
698
+ *
699
+ * // Get only public comments
700
+ * const publicComments = await sdk.phoneNumbers.getPortingComments("port_123...", { includeInternal: 'false' });
701
+ *
702
+ * // Get only internal comments
703
+ * const internalComments = await sdk.phoneNumbers.getPortingComments("port_123...", { includeInternal: 'only' });
704
+ */
705
+ async getPortingComments(id, { includeInternal = 'true' } = {}) {
706
+ this.sdk.validateParams(
707
+ { id },
708
+ {
709
+ id: { type: 'string', required: true },
710
+ },
711
+ );
712
+
713
+ const params = new URLSearchParams();
714
+ if (includeInternal !== 'true') {
715
+ params.append('includeInternal', includeInternal);
716
+ }
717
+
718
+ const queryString = params.toString();
719
+ const url = `/phoneNumbers/porting/orders/${id}/comments${queryString ? '?' + queryString : ''}`;
720
+
721
+ const result = await this.sdk._fetch(url, 'GET');
722
+ return result;
723
+ }
724
+
725
+ /**
726
+ * Post a comment on a porting order
727
+ * @param {string} id - Porting order ID
728
+ * @param {Object} params - Comment parameters
729
+ * @param {string} params.comment - Comment body text
730
+ * @param {boolean} [params.isInternal=false] - Whether this is an internal comment (not shared with carrier)
731
+ * @returns {Promise<Object>} Created comment details
732
+ * @example
733
+ * // Post a public comment (shared with carrier)
734
+ * const publicComment = await sdk.phoneNumbers.postPortingComment("port_123...", {
735
+ * comment: "Please expedite this port request",
736
+ * isInternal: false
737
+ * });
738
+ *
739
+ * // Post an internal comment (team use only)
740
+ * const internalComment = await sdk.phoneNumbers.postPortingComment("port_123...", {
741
+ * comment: "Customer called - they need this ASAP",
742
+ * isInternal: true
743
+ * });
744
+ */
745
+ async postPortingComment(id, { comment, isInternal = false }) {
746
+ this.sdk.validateParams(
747
+ { id, comment },
748
+ {
749
+ id: { type: 'string', required: true },
750
+ comment: { type: 'string', required: true },
751
+ isInternal: { type: 'boolean', required: false },
752
+ },
753
+ );
754
+
755
+ const result = await this.sdk._fetch(
756
+ `/phoneNumbers/porting/orders/${id}/comments`,
757
+ 'POST',
758
+ {
759
+ body: { comment, isInternal },
760
+ },
761
+ );
762
+ return result;
763
+ }
657
764
  }
658
765
 
659
766
  export class PhoneNumberCarrierService {