@unboundcx/sdk 4.10.1 → 4.11.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": "4.
|
|
3
|
+
"version": "4.11.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",
|
package/services/chat.js
CHANGED
|
@@ -825,9 +825,7 @@ export class ChatService {
|
|
|
825
825
|
|
|
826
826
|
/**
|
|
827
827
|
* Admin: get account-level chat settings.
|
|
828
|
-
* @returns {Promise<Object>} `{allowReports, reportReasons
|
|
829
|
-
* `reportNotifications[]` items are `{channelId, channelName, channelKind, reasons}` —
|
|
830
|
-
* `reasons` is `null` when the rule notifies for every reason.
|
|
828
|
+
* @returns {Promise<Object>} `{allowReports, reportReasons}`
|
|
831
829
|
*/
|
|
832
830
|
async adminGetSettings() {
|
|
833
831
|
return internalRequest(this.sdk, "/chat/admin/settings", "GET");
|
|
@@ -838,26 +836,18 @@ export class ChatService {
|
|
|
838
836
|
* @param {Object} params
|
|
839
837
|
* @param {boolean} params.allowReports
|
|
840
838
|
* @param {string[]} [params.reportReasons]
|
|
841
|
-
* @
|
|
842
|
-
* "message reported" card to. Each item: `{channelId: string, reasons:
|
|
843
|
-
* string[]|null}` — `reasons` null/empty means "notify for every
|
|
844
|
-
* reason"; channel must be a non-archived public/private channel.
|
|
845
|
-
* @returns {Promise<Object>} `{allowReports, reportReasons, reportNotifications}`
|
|
839
|
+
* @returns {Promise<Object>} `{allowReports, reportReasons}`
|
|
846
840
|
*/
|
|
847
|
-
async adminPutSettings({ allowReports, reportReasons
|
|
841
|
+
async adminPutSettings({ allowReports, reportReasons } = {}) {
|
|
848
842
|
this.sdk.validateParams(
|
|
849
|
-
{ allowReports, reportReasons
|
|
843
|
+
{ allowReports, reportReasons },
|
|
850
844
|
{
|
|
851
845
|
allowReports: { type: "boolean", required: true },
|
|
852
846
|
reportReasons: { type: "array", required: false },
|
|
853
|
-
reportNotifications: { type: "array", required: false },
|
|
854
847
|
},
|
|
855
848
|
);
|
|
856
849
|
const body = { allowReports };
|
|
857
850
|
if (reportReasons !== undefined) body.reportReasons = reportReasons;
|
|
858
|
-
if (reportNotifications !== undefined) {
|
|
859
|
-
body.reportNotifications = reportNotifications;
|
|
860
|
-
}
|
|
861
851
|
return internalRequest(this.sdk, "/chat/admin/settings", "PUT", {
|
|
862
852
|
body,
|
|
863
853
|
});
|
package/services/drive.js
CHANGED
|
@@ -95,7 +95,6 @@ export class DriveService {
|
|
|
95
95
|
`/drive/folders/${id}`,
|
|
96
96
|
'PATCH',
|
|
97
97
|
{ body },
|
|
98
|
-
true,
|
|
99
98
|
);
|
|
100
99
|
return result;
|
|
101
100
|
}
|
|
@@ -140,7 +139,6 @@ export class DriveService {
|
|
|
140
139
|
`/drive/files/${id}`,
|
|
141
140
|
'PATCH',
|
|
142
141
|
{ body },
|
|
143
|
-
true,
|
|
144
142
|
);
|
|
145
143
|
return result;
|
|
146
144
|
}
|
|
@@ -169,7 +167,6 @@ export class DriveService {
|
|
|
169
167
|
'/drive/files/move',
|
|
170
168
|
'PATCH',
|
|
171
169
|
{ body },
|
|
172
|
-
true,
|
|
173
170
|
);
|
|
174
171
|
return result;
|
|
175
172
|
}
|
|
@@ -163,4 +163,81 @@ export class EmailTemplatesService {
|
|
|
163
163
|
const result = await internalRequest(this.sdk, '/messaging/email/template', 'GET');
|
|
164
164
|
return result;
|
|
165
165
|
}
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Render a template (saved or draft fields) with sample variables for
|
|
169
|
+
* preview, without sending or saving.
|
|
170
|
+
* @param {string} id - Template ID (required)
|
|
171
|
+
* @param {Object} [body] - Draft fields to render
|
|
172
|
+
* @param {string} [body.subject] - Draft subject
|
|
173
|
+
* @param {string} [body.html] - Draft HTML body
|
|
174
|
+
* @param {string} [body.text] - Draft plain-text body
|
|
175
|
+
* @param {Object} [body.variables] - Variable substitution values
|
|
176
|
+
* @returns {Promise<Object>} Rendered preview
|
|
177
|
+
* @example
|
|
178
|
+
* const preview = await sdk.messaging.email.templates.preview('tpl_123', {
|
|
179
|
+
* subject: 'Welcome {{firstName}}',
|
|
180
|
+
* html: '<p>Hello {{firstName}}</p>',
|
|
181
|
+
* variables: { firstName: 'Jane' },
|
|
182
|
+
* });
|
|
183
|
+
*/
|
|
184
|
+
async preview(id, { subject, html, text, variables } = {}) {
|
|
185
|
+
this.sdk.validateParams(
|
|
186
|
+
{ id },
|
|
187
|
+
{
|
|
188
|
+
id: { type: 'string', required: true },
|
|
189
|
+
},
|
|
190
|
+
);
|
|
191
|
+
|
|
192
|
+
const previewData = {};
|
|
193
|
+
if (subject !== undefined) previewData.subject = subject;
|
|
194
|
+
if (html !== undefined) previewData.html = html;
|
|
195
|
+
if (text !== undefined) previewData.text = text;
|
|
196
|
+
if (variables !== undefined) previewData.variables = variables;
|
|
197
|
+
|
|
198
|
+
const options = {
|
|
199
|
+
body: previewData,
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
const result = await internalRequest(this.sdk,
|
|
203
|
+
`/messaging/email/template/${id}/preview`,
|
|
204
|
+
'POST',
|
|
205
|
+
options,
|
|
206
|
+
);
|
|
207
|
+
return result;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* Send a test email of a template to an address.
|
|
212
|
+
* @param {string} id - Template ID (required)
|
|
213
|
+
* @param {string} to - Destination email address (required)
|
|
214
|
+
* @param {Object} [body] - Optional overrides (from, subject, html, text, variables)
|
|
215
|
+
* @returns {Promise<Object>} Send confirmation
|
|
216
|
+
* @example
|
|
217
|
+
* await sdk.messaging.email.templates.sendTest('tpl_123', 'a@b.com');
|
|
218
|
+
* await sdk.messaging.email.templates.sendTest('tpl_123', 'a@b.com', {
|
|
219
|
+
* from: 'noreply@example.com',
|
|
220
|
+
* subject: 'Test subject',
|
|
221
|
+
* });
|
|
222
|
+
*/
|
|
223
|
+
async sendTest(id, to, body = {}) {
|
|
224
|
+
this.sdk.validateParams(
|
|
225
|
+
{ id, to },
|
|
226
|
+
{
|
|
227
|
+
id: { type: 'string', required: true },
|
|
228
|
+
to: { type: 'string', required: true },
|
|
229
|
+
},
|
|
230
|
+
);
|
|
231
|
+
|
|
232
|
+
const options = {
|
|
233
|
+
body: { to, ...body },
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
const result = await internalRequest(this.sdk,
|
|
237
|
+
`/messaging/email/template/${id}/test`,
|
|
238
|
+
'POST',
|
|
239
|
+
options,
|
|
240
|
+
);
|
|
241
|
+
return result;
|
|
242
|
+
}
|
|
166
243
|
}
|
package/services/storage.js
CHANGED
|
@@ -814,7 +814,6 @@ Response:
|
|
|
814
814
|
`/storage/files/${id}`,
|
|
815
815
|
'PATCH',
|
|
816
816
|
{ body },
|
|
817
|
-
true,
|
|
818
817
|
);
|
|
819
818
|
return result;
|
|
820
819
|
}
|
|
@@ -960,7 +959,6 @@ Response:
|
|
|
960
959
|
`/storage/folders/${id}`,
|
|
961
960
|
'PATCH',
|
|
962
961
|
{ body },
|
|
963
|
-
true,
|
|
964
962
|
);
|
|
965
963
|
return result;
|
|
966
964
|
}
|
|
@@ -1016,7 +1014,6 @@ Response:
|
|
|
1016
1014
|
'/storage/files/move',
|
|
1017
1015
|
'PATCH',
|
|
1018
1016
|
{ body },
|
|
1019
|
-
true,
|
|
1020
1017
|
);
|
|
1021
1018
|
return result;
|
|
1022
1019
|
}
|