@unboundcx/sdk 4.0.5 → 4.0.6

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/index.js CHANGED
@@ -27,6 +27,7 @@ import { EngagementMetricsService } from './services/engagementMetrics.js';
27
27
  import { TaskRouterService } from './services/taskRouter.js';
28
28
  import { KnowledgeBaseService } from './services/knowledgeBase.js';
29
29
  import { FaxService } from './services/fax.js';
30
+ import { DeveloperApisService } from './services/developerApis.js';
30
31
 
31
32
  class UnboundSDK extends BaseSDK {
32
33
  constructor(options = {}) {
@@ -95,6 +96,7 @@ class UnboundSDK extends BaseSDK {
95
96
  this.taskRouter = new TaskRouterService(this);
96
97
  this.knowledgeBase = new KnowledgeBaseService(this);
97
98
  this.fax = new FaxService(this);
99
+ this.developerApis = new DeveloperApisService(this);
98
100
 
99
101
  // Add additional services that might be missing
100
102
  this._initializeAdditionalServices();
@@ -274,4 +276,5 @@ export { TaskRouterService } from './services/taskRouter.js';
274
276
  export { WorkerService } from './services/taskRouter/WorkerService.js';
275
277
  export { KnowledgeBaseService } from './services/knowledgeBase.js';
276
278
  export { FaxService } from './services/fax.js';
279
+ export { DeveloperApisService } from './services/developerApis.js';
277
280
  export { BaseSDK } from './base.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unboundcx/sdk",
3
- "version": "4.0.5",
3
+ "version": "4.0.6",
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",
@@ -0,0 +1,222 @@
1
+ /**
2
+ * Developer portal My APIs — account-scoped folders, requests, vars, sharing.
3
+ * API prefix: /developerApis
4
+ */
5
+ export class DeveloperApisService {
6
+ constructor(sdk) {
7
+ this.sdk = sdk;
8
+ }
9
+
10
+ /**
11
+ * Full library for the current user (owned + shared folders/requests + personal vars).
12
+ * @returns {Promise<{ folders: object[], requests: object[], vars: object[], shares: object[] }>}
13
+ */
14
+ async getLibrary() {
15
+ return this.sdk._fetch('/developerApis', 'GET');
16
+ }
17
+
18
+ // ——— Folders ———
19
+
20
+ /**
21
+ * @param {{ name?: string, parentId?: string|null, sort?: number }} [params]
22
+ */
23
+ async createFolder(params = {}) {
24
+ const { name, parentId, sort } = params;
25
+ this.sdk.validateParams(
26
+ { name, parentId, sort },
27
+ {
28
+ name: { type: 'string', required: false },
29
+ parentId: { type: 'string', required: false },
30
+ sort: { type: 'number', required: false },
31
+ },
32
+ );
33
+ return this.sdk._fetch('/developerApis/folders', 'POST', {
34
+ body: { name, parentId, sort },
35
+ });
36
+ }
37
+
38
+ /**
39
+ * @param {string} id
40
+ * @param {{ name?: string, parentId?: string|null, sort?: number }} updates
41
+ */
42
+ async updateFolder(id, updates = {}) {
43
+ this.sdk.validateParams(
44
+ { id, updates },
45
+ {
46
+ id: { type: 'string', required: true },
47
+ updates: { type: 'object', required: true },
48
+ },
49
+ );
50
+ return this.sdk._fetch(`/developerApis/folders/${id}`, 'PUT', {
51
+ body: updates,
52
+ });
53
+ }
54
+
55
+ /**
56
+ * @param {string} id
57
+ */
58
+ async deleteFolder(id) {
59
+ this.sdk.validateParams({ id }, { id: { type: 'string', required: true } });
60
+ return this.sdk._fetch(`/developerApis/folders/${id}`, 'DELETE');
61
+ }
62
+
63
+ // ——— Folder sharing ———
64
+
65
+ /**
66
+ * @param {string} folderId
67
+ */
68
+ async listFolderShares(folderId) {
69
+ this.sdk.validateParams(
70
+ { folderId },
71
+ { folderId: { type: 'string', required: true } },
72
+ );
73
+ return this.sdk._fetch(`/developerApis/folders/${folderId}/shares`, 'GET');
74
+ }
75
+
76
+ /**
77
+ * Share a folder with a user.
78
+ * @param {string} folderId
79
+ * @param {{ userId: string, access?: 'full'|'limited' }} params
80
+ */
81
+ async shareFolder(folderId, params) {
82
+ const { userId, access } = params || {};
83
+ this.sdk.validateParams(
84
+ { folderId, userId, access },
85
+ {
86
+ folderId: { type: 'string', required: true },
87
+ userId: { type: 'string', required: true },
88
+ access: { type: 'string', required: false },
89
+ },
90
+ );
91
+ return this.sdk._fetch(`/developerApis/folders/${folderId}/shares`, 'POST', {
92
+ body: { userId, access: access === 'full' ? 'full' : 'limited' },
93
+ });
94
+ }
95
+
96
+ /**
97
+ * @param {string} folderId
98
+ * @param {string} userId
99
+ */
100
+ async unshareFolder(folderId, userId) {
101
+ this.sdk.validateParams(
102
+ { folderId, userId },
103
+ {
104
+ folderId: { type: 'string', required: true },
105
+ userId: { type: 'string', required: true },
106
+ },
107
+ );
108
+ return this.sdk._fetch(
109
+ `/developerApis/folders/${folderId}/shares/${userId}`,
110
+ 'DELETE',
111
+ );
112
+ }
113
+
114
+ // ——— Requests ———
115
+
116
+ /**
117
+ * @param {object} [request] freeform request body
118
+ */
119
+ async createRequest(request = {}) {
120
+ this.sdk.validateParams(
121
+ { request },
122
+ { request: { type: 'object', required: false } },
123
+ );
124
+ return this.sdk._fetch('/developerApis/requests', 'POST', {
125
+ body: request,
126
+ });
127
+ }
128
+
129
+ /**
130
+ * @param {string} id
131
+ */
132
+ async getRequest(id) {
133
+ this.sdk.validateParams({ id }, { id: { type: 'string', required: true } });
134
+ return this.sdk._fetch(`/developerApis/requests/${id}`, 'GET');
135
+ }
136
+
137
+ /**
138
+ * @param {string} id
139
+ * @param {object} updates
140
+ */
141
+ async updateRequest(id, updates = {}) {
142
+ this.sdk.validateParams(
143
+ { id, updates },
144
+ {
145
+ id: { type: 'string', required: true },
146
+ updates: { type: 'object', required: true },
147
+ },
148
+ );
149
+ return this.sdk._fetch(`/developerApis/requests/${id}`, 'PUT', {
150
+ body: updates,
151
+ });
152
+ }
153
+
154
+ /**
155
+ * @param {string} id
156
+ */
157
+ async deleteRequest(id) {
158
+ this.sdk.validateParams({ id }, { id: { type: 'string', required: true } });
159
+ return this.sdk._fetch(`/developerApis/requests/${id}`, 'DELETE');
160
+ }
161
+
162
+ /**
163
+ * Clone a request (caller becomes owner of the copy).
164
+ * @param {string} id
165
+ */
166
+ async cloneRequest(id) {
167
+ this.sdk.validateParams({ id }, { id: { type: 'string', required: true } });
168
+ return this.sdk._fetch(`/developerApis/requests/${id}/clone`, 'POST', {
169
+ body: {},
170
+ });
171
+ }
172
+
173
+ // ——— Vars (personal) ———
174
+
175
+ async listVars() {
176
+ return this.sdk._fetch('/developerApis/vars', 'GET');
177
+ }
178
+
179
+ /**
180
+ * @param {{ key?: string, type?: 'default'|'secret', value?: string, enabled?: boolean }} [params]
181
+ */
182
+ async createVar(params = {}) {
183
+ const { key, type, value, enabled } = params;
184
+ this.sdk.validateParams(
185
+ { key, type, value, enabled },
186
+ {
187
+ key: { type: 'string', required: false },
188
+ type: { type: 'string', required: false },
189
+ value: { type: 'string', required: false },
190
+ enabled: { type: 'boolean', required: false },
191
+ },
192
+ );
193
+ return this.sdk._fetch('/developerApis/vars', 'POST', {
194
+ body: { key, type, value, enabled },
195
+ });
196
+ }
197
+
198
+ /**
199
+ * @param {string} id
200
+ * @param {{ key?: string, type?: string, value?: string, enabled?: boolean }} updates
201
+ */
202
+ async updateVar(id, updates = {}) {
203
+ this.sdk.validateParams(
204
+ { id, updates },
205
+ {
206
+ id: { type: 'string', required: true },
207
+ updates: { type: 'object', required: true },
208
+ },
209
+ );
210
+ return this.sdk._fetch(`/developerApis/vars/${id}`, 'PUT', {
211
+ body: updates,
212
+ });
213
+ }
214
+
215
+ /**
216
+ * @param {string} id
217
+ */
218
+ async deleteVar(id) {
219
+ this.sdk.validateParams({ id }, { id: { type: 'string', required: true } });
220
+ return this.sdk._fetch(`/developerApis/vars/${id}`, 'DELETE');
221
+ }
222
+ }
@@ -33,6 +33,7 @@ async function testBasicSDKFunctionality() {
33
33
  'subscriptions',
34
34
  'workflows',
35
35
  'notes',
36
+ 'developerApis',
36
37
  'storage',
37
38
  'verification',
38
39
  'portals',
@@ -29,6 +29,7 @@ async function testPublicSDKCompleteness() {
29
29
  'subscriptions',
30
30
  'workflows',
31
31
  'notes',
32
+ 'developerApis',
32
33
  'storage',
33
34
  'verification',
34
35
  'portals',
@@ -109,6 +109,7 @@ const services = [
109
109
  'subscriptions',
110
110
  'workflows',
111
111
  'notes',
112
+ 'developerApis',
112
113
  'storage',
113
114
  'verification',
114
115
  'portals',