@unboundcx/sdk 4.9.2 → 4.9.3
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 +1 -1
- package/services/chat.js +52 -6
- package/services/phoneNumbers.js +28 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unboundcx/sdk",
|
|
3
|
-
"version": "4.9.
|
|
3
|
+
"version": "4.9.3",
|
|
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",
|
package/services/chat.js
CHANGED
|
@@ -788,22 +788,68 @@ export class ChatService {
|
|
|
788
788
|
}
|
|
789
789
|
|
|
790
790
|
/**
|
|
791
|
-
* Report a message.
|
|
791
|
+
* Report a message. Refused (403) if reporting is disabled for the
|
|
792
|
+
* account, the message is the caller's own, a system message, or
|
|
793
|
+
* already deleted.
|
|
792
794
|
* @param {string} id
|
|
793
795
|
* @param {Object} params
|
|
794
|
-
* @param {string} params.reason
|
|
796
|
+
* @param {string} [params.reason] - One of the account's reportReasons
|
|
797
|
+
* @param {string} [params.note] - Optional free-text detail (max 500 chars)
|
|
795
798
|
* @returns {Promise<Object>}
|
|
796
799
|
*/
|
|
797
|
-
async reportMessage(id, { reason } = {}) {
|
|
800
|
+
async reportMessage(id, { reason, note } = {}) {
|
|
798
801
|
this.sdk.validateParams(
|
|
799
|
-
{ id, reason },
|
|
802
|
+
{ id, reason, note },
|
|
800
803
|
{
|
|
801
804
|
id: { type: "string", required: true },
|
|
802
|
-
reason: { type: "string", required:
|
|
805
|
+
reason: { type: "string", required: false },
|
|
806
|
+
note: { type: "string", required: false },
|
|
803
807
|
},
|
|
804
808
|
);
|
|
809
|
+
const body = {};
|
|
810
|
+
if (reason !== undefined) body.reason = reason;
|
|
811
|
+
if (note !== undefined) body.note = note;
|
|
805
812
|
return internalRequest(this.sdk, `/chat/messages/${id}/report`, "POST", {
|
|
806
|
-
body
|
|
813
|
+
body,
|
|
814
|
+
});
|
|
815
|
+
}
|
|
816
|
+
|
|
817
|
+
/**
|
|
818
|
+
* Get chat settings relevant to the caller (e.g. whether message
|
|
819
|
+
* reporting is enabled for the account).
|
|
820
|
+
* @returns {Promise<Object>} `{allowReports, reportReasons}`
|
|
821
|
+
*/
|
|
822
|
+
async getSettings() {
|
|
823
|
+
return internalRequest(this.sdk, "/chat/settings", "GET");
|
|
824
|
+
}
|
|
825
|
+
|
|
826
|
+
/**
|
|
827
|
+
* Admin: get account-level chat settings.
|
|
828
|
+
* @returns {Promise<Object>} `{allowReports, reportReasons}`
|
|
829
|
+
*/
|
|
830
|
+
async adminGetSettings() {
|
|
831
|
+
return internalRequest(this.sdk, "/chat/admin/settings", "GET");
|
|
832
|
+
}
|
|
833
|
+
|
|
834
|
+
/**
|
|
835
|
+
* Admin: update account-level chat settings.
|
|
836
|
+
* @param {Object} params
|
|
837
|
+
* @param {boolean} params.allowReports
|
|
838
|
+
* @param {string[]} [params.reportReasons]
|
|
839
|
+
* @returns {Promise<Object>} `{allowReports, reportReasons}`
|
|
840
|
+
*/
|
|
841
|
+
async adminPutSettings({ allowReports, reportReasons } = {}) {
|
|
842
|
+
this.sdk.validateParams(
|
|
843
|
+
{ allowReports, reportReasons },
|
|
844
|
+
{
|
|
845
|
+
allowReports: { type: "boolean", required: true },
|
|
846
|
+
reportReasons: { type: "array", required: false },
|
|
847
|
+
},
|
|
848
|
+
);
|
|
849
|
+
const body = { allowReports };
|
|
850
|
+
if (reportReasons !== undefined) body.reportReasons = reportReasons;
|
|
851
|
+
return internalRequest(this.sdk, "/chat/admin/settings", "PUT", {
|
|
852
|
+
body,
|
|
807
853
|
});
|
|
808
854
|
}
|
|
809
855
|
|
package/services/phoneNumbers.js
CHANGED
|
@@ -773,6 +773,34 @@ export class PhoneNumbersService {
|
|
|
773
773
|
return result;
|
|
774
774
|
}
|
|
775
775
|
|
|
776
|
+
/**
|
|
777
|
+
* Mark a porting-order exception as resolved after the user has updated
|
|
778
|
+
* the order (documents, account number, etc.). Syncs with the carrier
|
|
779
|
+
* so local status picks up the next Telnyx state.
|
|
780
|
+
* @param {string} id - Porting order ID
|
|
781
|
+
* @param {string} exceptionId - Exception ID
|
|
782
|
+
* @param {Object} [options]
|
|
783
|
+
* @param {string} [options.resolution]
|
|
784
|
+
* @returns {Promise<Object>} Updated exception
|
|
785
|
+
*/
|
|
786
|
+
async resolvePortingException(id, exceptionId, { resolution } = {}) {
|
|
787
|
+
this.sdk.validateParams(
|
|
788
|
+
{ id, exceptionId },
|
|
789
|
+
{
|
|
790
|
+
id: { type: 'string', required: true },
|
|
791
|
+
exceptionId: { type: 'string', required: true },
|
|
792
|
+
},
|
|
793
|
+
);
|
|
794
|
+
const body = {};
|
|
795
|
+
if (resolution) body.resolution = resolution;
|
|
796
|
+
return internalRequest(
|
|
797
|
+
this.sdk,
|
|
798
|
+
`/phoneNumbers/porting/orders/${id}/exceptions/${exceptionId}/resolve`,
|
|
799
|
+
'POST',
|
|
800
|
+
{ body },
|
|
801
|
+
);
|
|
802
|
+
}
|
|
803
|
+
|
|
776
804
|
/**
|
|
777
805
|
* Get comments for a porting order
|
|
778
806
|
* @param {string} id - Porting order ID
|