@unboundcx/sdk 1.2.5 → 1.3.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/base.js +29 -2
- package/package.json +1 -1
- package/services/login.js +21 -0
- package/services/objects.js +136 -0
- package/services/storage.js +1 -1
package/base.js
CHANGED
|
@@ -203,14 +203,41 @@ export class BaseSDK {
|
|
|
203
203
|
return this._httpRequest(endpoint, method, params);
|
|
204
204
|
}
|
|
205
205
|
|
|
206
|
+
_isMultipartBody(body) {
|
|
207
|
+
// Check if body is FormData or multipart content
|
|
208
|
+
if (!body) return false;
|
|
209
|
+
|
|
210
|
+
// Browser FormData
|
|
211
|
+
if (typeof FormData !== 'undefined' && body instanceof FormData) {
|
|
212
|
+
return true;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
// Node.js Buffer (our manual multipart construction)
|
|
216
|
+
if (typeof Buffer !== 'undefined' && Buffer.isBuffer(body)) {
|
|
217
|
+
return true;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
// Uint8Array (fallback multipart construction)
|
|
221
|
+
if (body instanceof Uint8Array) {
|
|
222
|
+
return true;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
// String-based multipart (check for multipart boundaries)
|
|
226
|
+
if (typeof body === 'string' && body.includes('Content-Disposition: form-data')) {
|
|
227
|
+
return true;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
return false;
|
|
231
|
+
}
|
|
232
|
+
|
|
206
233
|
async _httpRequest(endpoint, method, params = {}) {
|
|
207
234
|
const { body, query, headers = {} } = params;
|
|
208
235
|
|
|
209
236
|
const options = {
|
|
210
237
|
method,
|
|
211
238
|
headers: {
|
|
212
|
-
//
|
|
213
|
-
...(headers?.['Content-Type'] || headers?.['content-type']
|
|
239
|
+
// Smart content-type detection based on actual body content
|
|
240
|
+
...(this._isMultipartBody(body) || headers?.['Content-Type'] || headers?.['content-type']
|
|
214
241
|
? {}
|
|
215
242
|
: { 'Content-Type': 'application/json' }),
|
|
216
243
|
...headers,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unboundcx/sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.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/login.js
CHANGED
|
@@ -110,4 +110,25 @@ export class LoginService {
|
|
|
110
110
|
);
|
|
111
111
|
return result;
|
|
112
112
|
}
|
|
113
|
+
|
|
114
|
+
async forgotPassword(email) {
|
|
115
|
+
this.sdk.validateParams(
|
|
116
|
+
{ email },
|
|
117
|
+
{
|
|
118
|
+
email: { type: 'string', required: true },
|
|
119
|
+
},
|
|
120
|
+
);
|
|
121
|
+
|
|
122
|
+
const options = {
|
|
123
|
+
body: { email },
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
const result = await this.sdk._fetch(
|
|
127
|
+
'/login/forgotPassword',
|
|
128
|
+
'POST',
|
|
129
|
+
options,
|
|
130
|
+
true,
|
|
131
|
+
);
|
|
132
|
+
return result;
|
|
133
|
+
}
|
|
113
134
|
}
|
package/services/objects.js
CHANGED
|
@@ -166,4 +166,140 @@ export class ObjectsService {
|
|
|
166
166
|
const result = await this.sdk._fetch(`/object/`, 'GET', params);
|
|
167
167
|
return result;
|
|
168
168
|
}
|
|
169
|
+
|
|
170
|
+
// ExpandDetails methods
|
|
171
|
+
async createExpandDetail(body = {}) {
|
|
172
|
+
this.sdk.validateParams(
|
|
173
|
+
{ body },
|
|
174
|
+
{
|
|
175
|
+
body: { type: 'object', required: true },
|
|
176
|
+
},
|
|
177
|
+
);
|
|
178
|
+
|
|
179
|
+
const params = { body };
|
|
180
|
+
|
|
181
|
+
const result = await this.sdk._fetch(`/object/expandDetails`, 'POST', params);
|
|
182
|
+
return result;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
async getExpandDetails(query = {}) {
|
|
186
|
+
this.sdk.validateParams(
|
|
187
|
+
{ query },
|
|
188
|
+
{
|
|
189
|
+
query: { type: 'object', required: false },
|
|
190
|
+
},
|
|
191
|
+
);
|
|
192
|
+
|
|
193
|
+
const params = { query };
|
|
194
|
+
|
|
195
|
+
const result = await this.sdk._fetch(`/object/expandDetails`, 'GET', params);
|
|
196
|
+
return result;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
async getExpandDetailById(id) {
|
|
200
|
+
this.sdk.validateParams(
|
|
201
|
+
{ id },
|
|
202
|
+
{
|
|
203
|
+
id: { type: 'string', required: true },
|
|
204
|
+
},
|
|
205
|
+
);
|
|
206
|
+
|
|
207
|
+
const result = await this.sdk._fetch(`/object/expandDetails/${id}`, 'GET');
|
|
208
|
+
return result;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
async updateExpandDetail(id, body = {}) {
|
|
212
|
+
this.sdk.validateParams(
|
|
213
|
+
{ id, body },
|
|
214
|
+
{
|
|
215
|
+
id: { type: 'string', required: true },
|
|
216
|
+
body: { type: 'object', required: true },
|
|
217
|
+
},
|
|
218
|
+
);
|
|
219
|
+
|
|
220
|
+
const params = { body };
|
|
221
|
+
|
|
222
|
+
const result = await this.sdk._fetch(`/object/expandDetails/${id}`, 'PUT', params);
|
|
223
|
+
return result;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
async deleteExpandDetail(id) {
|
|
227
|
+
this.sdk.validateParams(
|
|
228
|
+
{ id },
|
|
229
|
+
{
|
|
230
|
+
id: { type: 'string', required: true },
|
|
231
|
+
},
|
|
232
|
+
);
|
|
233
|
+
|
|
234
|
+
const result = await this.sdk._fetch(`/object/expandDetails/${id}`, 'DELETE');
|
|
235
|
+
return result;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
// GeneratedColumns methods
|
|
239
|
+
async createGeneratedColumn(body = {}) {
|
|
240
|
+
this.sdk.validateParams(
|
|
241
|
+
{ body },
|
|
242
|
+
{
|
|
243
|
+
body: { type: 'object', required: true },
|
|
244
|
+
},
|
|
245
|
+
);
|
|
246
|
+
|
|
247
|
+
const params = { body };
|
|
248
|
+
|
|
249
|
+
const result = await this.sdk._fetch(`/object/generatedColumns`, 'POST', params);
|
|
250
|
+
return result;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
async getGeneratedColumns(query = {}) {
|
|
254
|
+
this.sdk.validateParams(
|
|
255
|
+
{ query },
|
|
256
|
+
{
|
|
257
|
+
query: { type: 'object', required: false },
|
|
258
|
+
},
|
|
259
|
+
);
|
|
260
|
+
|
|
261
|
+
const params = { query };
|
|
262
|
+
|
|
263
|
+
const result = await this.sdk._fetch(`/object/generatedColumns`, 'GET', params);
|
|
264
|
+
return result;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
async getGeneratedColumnById(id) {
|
|
268
|
+
this.sdk.validateParams(
|
|
269
|
+
{ id },
|
|
270
|
+
{
|
|
271
|
+
id: { type: 'string', required: true },
|
|
272
|
+
},
|
|
273
|
+
);
|
|
274
|
+
|
|
275
|
+
const result = await this.sdk._fetch(`/object/generatedColumns/${id}`, 'GET');
|
|
276
|
+
return result;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
async updateGeneratedColumn(id, body = {}) {
|
|
280
|
+
this.sdk.validateParams(
|
|
281
|
+
{ id, body },
|
|
282
|
+
{
|
|
283
|
+
id: { type: 'string', required: true },
|
|
284
|
+
body: { type: 'object', required: true },
|
|
285
|
+
},
|
|
286
|
+
);
|
|
287
|
+
|
|
288
|
+
const params = { body };
|
|
289
|
+
|
|
290
|
+
const result = await this.sdk._fetch(`/object/generatedColumns/${id}`, 'PUT', params);
|
|
291
|
+
return result;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
async deleteGeneratedColumn(id) {
|
|
295
|
+
this.sdk.validateParams(
|
|
296
|
+
{ id },
|
|
297
|
+
{
|
|
298
|
+
id: { type: 'string', required: true },
|
|
299
|
+
},
|
|
300
|
+
);
|
|
301
|
+
|
|
302
|
+
const result = await this.sdk._fetch(`/object/generatedColumns/${id}`, 'DELETE');
|
|
303
|
+
return result;
|
|
304
|
+
}
|
|
169
305
|
}
|
package/services/storage.js
CHANGED