@unboundcx/sdk 2.5.0 → 2.6.0

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.5.0",
3
+ "version": "2.6.0",
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",
@@ -500,29 +500,40 @@ export class PhoneNumbersService {
500
500
  return result;
501
501
  }
502
502
 
503
- async uploadPortingDocument({
504
- filename,
505
- fileContent,
506
- contentType = 'application/pdf',
507
- documentType = 'loa',
503
+ /**
504
+ * Attach or update a document for a porting order
505
+ *
506
+ * @param {Object} params
507
+ * @param {string} params.portingOrderId - Porting order ID
508
+ * @param {string} [params.storageId] - Storage ID of uploaded file (null to clear)
509
+ * @param {string} [params.documentType='loa'] - Document type (loa, bill, csr, etc.)
510
+ * @param {boolean} [params.isRequired=false] - Whether document is required
511
+ * @param {string} [params.documentId] - Optional: Update existing document by ID
512
+ * @returns {Promise<Object>} Document attachment result with action (created/updated)
513
+ */
514
+ async attachPortingDocument({
508
515
  portingOrderId,
516
+ storageId = null,
517
+ documentType = 'loa',
518
+ isRequired = false,
519
+ documentId = null
509
520
  }) {
510
521
  this.sdk.validateParams(
511
- { filename, fileContent },
522
+ { portingOrderId, documentType },
512
523
  {
513
- filename: { type: 'string', required: true },
514
- fileContent: { type: 'string', required: true },
524
+ portingOrderId: { type: 'string', required: true },
525
+ documentType: { type: 'string', required: true },
515
526
  },
516
527
  );
517
528
 
518
529
  const body = {
519
- filename,
520
- fileContent,
521
- contentType,
530
+ portingOrderId,
531
+ storageId,
522
532
  documentType,
533
+ isRequired
523
534
  };
524
535
 
525
- if (portingOrderId) body.portingOrderId = portingOrderId;
536
+ if (documentId) body.documentId = documentId;
526
537
 
527
538
  const result = await this.sdk._fetch(
528
539
  '/phoneNumbers/porting/documents',
@@ -534,6 +545,38 @@ export class PhoneNumbersService {
534
545
  return result;
535
546
  }
536
547
 
548
+ /**
549
+ * Generate Letter of Authorization (LOA) for a porting order
550
+ *
551
+ * Automatically generates a PDF LOA document using template data from the porting order,
552
+ * uploads it to storage, and attaches it to the order as an LOA document.
553
+ *
554
+ * @param {Object} params
555
+ * @param {string} params.portingOrderId - Porting order ID to generate LOA for
556
+ * @param {string} params.signerName - Full name of person signing the LOA
557
+ * @param {string} params.signerTitle - Job title of person signing the LOA
558
+ * @returns {Promise<Object>} Generation result with document ID and storage information
559
+ */
560
+ async generateLoa({ portingOrderId, signerName, signerTitle }) {
561
+ this.sdk.validateParams(
562
+ { portingOrderId, signerName, signerTitle },
563
+ {
564
+ portingOrderId: { type: 'string', required: true },
565
+ signerName: { type: 'string', required: true },
566
+ signerTitle: { type: 'string', required: true },
567
+ },
568
+ );
569
+
570
+ const result = await this.sdk._fetch(
571
+ `/phoneNumbers/porting/orders/${encodeURIComponent(portingOrderId)}/generate-loa`,
572
+ 'POST',
573
+ {
574
+ body: { signerName, signerTitle },
575
+ },
576
+ );
577
+ return result;
578
+ }
579
+
537
580
  async getPortingEvents(id, { page, limit } = {}) {
538
581
  this.sdk.validateParams(
539
582
  { id },