edge-impulse-api 1.94.0 → 1.94.2

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.
Files changed (42) hide show
  1. package/build/browser/edge-impulse-api.d.ts +255 -3
  2. package/build/browser/edge-impulse-api.js +1016 -229
  3. package/build/browser/edge-impulse-api.js.map +1 -1
  4. package/build/library/sdk/api/apis.d.ts +3 -1
  5. package/build/library/sdk/api/apis.js +3 -1
  6. package/build/library/sdk/api/apis.js.map +1 -1
  7. package/build/library/sdk/api/organizationOAuthClientsApi.d.ts +167 -0
  8. package/build/library/sdk/api/organizationOAuthClientsApi.js +726 -0
  9. package/build/library/sdk/api/organizationOAuthClientsApi.js.map +1 -0
  10. package/build/library/sdk/model/createOAuthClientRequest.d.ts +8 -0
  11. package/build/library/sdk/model/createOAuthClientRequest.js +4 -0
  12. package/build/library/sdk/model/createOAuthClientRequest.js.map +1 -0
  13. package/build/library/sdk/model/createOAuthClientResponse.d.ts +13 -0
  14. package/build/library/sdk/model/createOAuthClientResponse.js +4 -0
  15. package/build/library/sdk/model/createOAuthClientResponse.js.map +1 -0
  16. package/build/library/sdk/model/deploymentTarget.d.ts +4 -1
  17. package/build/library/sdk/model/deploymentTarget.js.map +1 -1
  18. package/build/library/sdk/model/deploymentTargetEngine.js.map +1 -1
  19. package/build/library/sdk/model/feature.d.ts +1 -1
  20. package/build/library/sdk/model/feature.js +1 -1
  21. package/build/library/sdk/model/feature.js.map +1 -1
  22. package/build/library/sdk/model/getOrganizationOAuthClientResponse.d.ts +12 -0
  23. package/build/library/sdk/model/getOrganizationOAuthClientResponse.js +4 -0
  24. package/build/library/sdk/model/getOrganizationOAuthClientResponse.js.map +1 -0
  25. package/build/library/sdk/model/listOrganizationOAuthClientsResponse.d.ts +12 -0
  26. package/build/library/sdk/model/listOrganizationOAuthClientsResponse.js +4 -0
  27. package/build/library/sdk/model/listOrganizationOAuthClientsResponse.js.map +1 -0
  28. package/build/library/sdk/model/models.d.ts +7 -0
  29. package/build/library/sdk/model/models.js +7 -0
  30. package/build/library/sdk/model/models.js.map +1 -1
  31. package/build/library/sdk/model/projectDeploymentTarget.d.ts +3 -0
  32. package/build/library/sdk/model/projectDeploymentTarget.js.map +1 -1
  33. package/build/library/sdk/model/rotateOAuthClientSecretResponse.d.ts +11 -0
  34. package/build/library/sdk/model/rotateOAuthClientSecretResponse.js +4 -0
  35. package/build/library/sdk/model/rotateOAuthClientSecretResponse.js.map +1 -0
  36. package/build/library/sdk/model/selfServeOAuthClient.d.ts +13 -0
  37. package/build/library/sdk/model/selfServeOAuthClient.js +4 -0
  38. package/build/library/sdk/model/selfServeOAuthClient.js.map +1 -0
  39. package/build/library/sdk/model/updateOAuthClientRequest.d.ts +7 -0
  40. package/build/library/sdk/model/updateOAuthClientRequest.js +4 -0
  41. package/build/library/sdk/model/updateOAuthClientRequest.js.map +1 -0
  42. package/package.json +1 -1
@@ -0,0 +1,726 @@
1
+ "use strict";
2
+ /**
3
+ * Edge Impulse API
4
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
+ *
6
+ * The version of the OpenAPI document: 1.0.0
7
+ *
8
+ *
9
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
10
+ * https://openapi-generator.tech
11
+ * Do not edit the class manually.
12
+ */
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.OrganizationOAuthClientsApi = exports.OrganizationOAuthClientsApiApiKeys = void 0;
15
+ let fetch;
16
+ let FormData;
17
+ if (globalThis.fetch && globalThis.FormData) {
18
+ fetch = globalThis.fetch;
19
+ FormData = globalThis.FormData;
20
+ }
21
+ else {
22
+ const undici = require('undici');
23
+ fetch = undici.fetch;
24
+ FormData = undici.FormData;
25
+ }
26
+ const models_1 = require("../model/models");
27
+ const models_2 = require("../model/models");
28
+ let defaultBasePath = 'https://studio.edgeimpulse.com/v1';
29
+ // ===============================================
30
+ // This file is autogenerated - Please do not edit
31
+ // ===============================================
32
+ var OrganizationOAuthClientsApiApiKeys;
33
+ (function (OrganizationOAuthClientsApiApiKeys) {
34
+ OrganizationOAuthClientsApiApiKeys[OrganizationOAuthClientsApiApiKeys["ApiKeyAuthentication"] = 0] = "ApiKeyAuthentication";
35
+ OrganizationOAuthClientsApiApiKeys[OrganizationOAuthClientsApiApiKeys["JWTAuthentication"] = 1] = "JWTAuthentication";
36
+ OrganizationOAuthClientsApiApiKeys[OrganizationOAuthClientsApiApiKeys["JWTHttpHeaderAuthentication"] = 2] = "JWTHttpHeaderAuthentication";
37
+ })(OrganizationOAuthClientsApiApiKeys = exports.OrganizationOAuthClientsApiApiKeys || (exports.OrganizationOAuthClientsApiApiKeys = {}));
38
+ class OrganizationOAuthClientsApi {
39
+ async handleResponse(response, returnType) {
40
+ let body = await (0, models_1.parseResponse)(response);
41
+ if (!response.ok) {
42
+ let errorMsg;
43
+ if (typeof body === 'object' && body !== null && 'error' in body) {
44
+ errorMsg = body.error;
45
+ }
46
+ else {
47
+ errorMsg = `Failed to call "${response.url}", returned ${response.status}: ` + (typeof body === 'string' ? body : JSON.stringify(body));
48
+ }
49
+ throw new Error(errorMsg);
50
+ }
51
+ if (typeof body.success === 'boolean' && !body.success) {
52
+ const errString = `Failed to call "${response.url}", returned ${response.status}: ` + body.error;
53
+ throw new Error(body.error || errString);
54
+ }
55
+ return (0, models_1.convertISODateStringsOnObj)(body);
56
+ }
57
+ constructor(basePathOrUsername, opts, password, basePath) {
58
+ this._basePath = defaultBasePath;
59
+ this.defaultHeaders = {};
60
+ this._opts = {};
61
+ this.authentications = {
62
+ 'default': new models_1.VoidAuth(),
63
+ 'ApiKeyAuthentication': new models_2.ApiKeyAuth('header', 'x-api-key'),
64
+ 'OAuth2': new models_2.OAuth(),
65
+ 'JWTAuthentication': new models_2.ApiKeyAuth('cookie', 'jwt'),
66
+ 'JWTHttpHeaderAuthentication': new models_2.ApiKeyAuth('header', 'x-jwt-token'),
67
+ };
68
+ if (password) {
69
+ if (basePath) {
70
+ this.basePath = basePath;
71
+ }
72
+ }
73
+ else {
74
+ if (basePathOrUsername) {
75
+ this.basePath = basePathOrUsername;
76
+ }
77
+ }
78
+ this.opts = opts !== null && opts !== void 0 ? opts : {};
79
+ }
80
+ set basePath(basePath) {
81
+ this._basePath = basePath;
82
+ }
83
+ get basePath() {
84
+ return this._basePath;
85
+ }
86
+ set opts(opts) {
87
+ this._opts = opts;
88
+ }
89
+ get opts() {
90
+ return this._opts;
91
+ }
92
+ setDefaultAuthentication(auth) {
93
+ this.authentications.default = auth;
94
+ }
95
+ setApiKey(key, value) {
96
+ this.authentications[OrganizationOAuthClientsApiApiKeys[key]].apiKey = value;
97
+ }
98
+ set accessToken(token) {
99
+ this.authentications.OAuth2.accessToken = token;
100
+ }
101
+ /**
102
+ * Registers a new OAuth app owned by the developer profile organization and returns the client id and one-time client secret.
103
+ * @summary Create an OAuth app
104
+ * @param organizationId Organization ID
105
+ * @param createOAuthClientRequest
106
+ */
107
+ async createOrganizationOAuthClient(organizationId, createOAuthClientRequest, options = { headers: {} }) {
108
+ const localVarPath = this.basePath + '/api/organizations/{organizationId}/oauth-clients'
109
+ .replace('{' + 'organizationId' + '}', encodeURIComponent(String(organizationId)));
110
+ let queryParameters = {};
111
+ let localVarHeaderParams = {
112
+ 'User-Agent': 'edgeimpulse-api nodejs',
113
+ 'Content-Type': 'application/json',
114
+ ...this.defaultHeaders,
115
+ };
116
+ const produces = ['application/json'];
117
+ // give precedence to 'application/json'
118
+ if (produces.indexOf('application/json') >= 0) {
119
+ localVarHeaderParams.Accept = 'application/json';
120
+ }
121
+ else {
122
+ localVarHeaderParams.Accept = produces.join(',');
123
+ }
124
+ let localVarFormParams;
125
+ // verify required parameter 'organizationId' is not null or undefined
126
+ if (organizationId === null || organizationId === undefined) {
127
+ throw new Error('Required parameter organizationId was null or undefined when calling createOrganizationOAuthClient.');
128
+ }
129
+ // verify required parameter 'createOAuthClientRequest' is not null or undefined
130
+ if (createOAuthClientRequest === null || createOAuthClientRequest === undefined) {
131
+ throw new Error('Required parameter createOAuthClientRequest was null or undefined when calling createOrganizationOAuthClient.');
132
+ }
133
+ localVarHeaderParams = {
134
+ ...localVarHeaderParams,
135
+ ...options.headers,
136
+ ...this.opts.extraHeaders,
137
+ };
138
+ const queryString = Object.entries(queryParameters)
139
+ .filter(([, value]) => value !== undefined)
140
+ .map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
141
+ .join('&');
142
+ let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
143
+ let localVarRequestOptions = {
144
+ method: 'POST',
145
+ headers: { ...localVarHeaderParams },
146
+ };
147
+ localVarRequestOptions.body = JSON.stringify(createOAuthClientRequest);
148
+ let requestOptions = localVarRequestOptions;
149
+ let url = localVarUrl;
150
+ const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
151
+ requestOptions = auth_ApiKeyAuthentication.requestOptions;
152
+ url = auth_ApiKeyAuthentication.url;
153
+ const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
154
+ requestOptions = auth_JWTAuthentication.requestOptions;
155
+ url = auth_JWTAuthentication.url;
156
+ const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
157
+ requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
158
+ url = auth_JWTHttpHeaderAuthentication.url;
159
+ const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
160
+ requestOptions = auth_OAuth2.requestOptions;
161
+ url = auth_OAuth2.url;
162
+ const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
163
+ requestOptions = authDefault.requestOptions;
164
+ url = authDefault.url;
165
+ (0, models_1.applyFormParams)(requestOptions, localVarFormParams);
166
+ const response = await fetch(url, requestOptions);
167
+ const resp = this.handleResponse(response, 'CreateOAuthClientResponse');
168
+ if (options === null || options === void 0 ? void 0 : options.responseHeadersCallback) {
169
+ const headerCb = options.responseHeadersCallback;
170
+ // on next tick, so we have time to handle the response
171
+ setTimeout(() => {
172
+ headerCb(Object.fromEntries(response.headers.entries()));
173
+ }, 0);
174
+ }
175
+ return resp;
176
+ }
177
+ /**
178
+ * Deletes an OAuth app owned by the developer profile organization and revokes its tokens and authorization codes.
179
+ * @summary Delete an OAuth app
180
+ * @param organizationId Organization ID
181
+ * @param oauthClientId
182
+ */
183
+ async deleteOrganizationOAuthClient(organizationId, oauthClientId, options = { headers: {} }) {
184
+ const localVarPath = this.basePath + '/api/organizations/{organizationId}/oauth-clients/{oauthClientId}'
185
+ .replace('{' + 'organizationId' + '}', encodeURIComponent(String(organizationId)))
186
+ .replace('{' + 'oauthClientId' + '}', encodeURIComponent(String(oauthClientId)));
187
+ let queryParameters = {};
188
+ let localVarHeaderParams = {
189
+ 'User-Agent': 'edgeimpulse-api nodejs',
190
+ 'Content-Type': 'application/json',
191
+ ...this.defaultHeaders,
192
+ };
193
+ const produces = ['application/json'];
194
+ // give precedence to 'application/json'
195
+ if (produces.indexOf('application/json') >= 0) {
196
+ localVarHeaderParams.Accept = 'application/json';
197
+ }
198
+ else {
199
+ localVarHeaderParams.Accept = produces.join(',');
200
+ }
201
+ let localVarFormParams;
202
+ // verify required parameter 'organizationId' is not null or undefined
203
+ if (organizationId === null || organizationId === undefined) {
204
+ throw new Error('Required parameter organizationId was null or undefined when calling deleteOrganizationOAuthClient.');
205
+ }
206
+ // verify required parameter 'oauthClientId' is not null or undefined
207
+ if (oauthClientId === null || oauthClientId === undefined) {
208
+ throw new Error('Required parameter oauthClientId was null or undefined when calling deleteOrganizationOAuthClient.');
209
+ }
210
+ localVarHeaderParams = {
211
+ ...localVarHeaderParams,
212
+ ...options.headers,
213
+ ...this.opts.extraHeaders,
214
+ };
215
+ const queryString = Object.entries(queryParameters)
216
+ .filter(([, value]) => value !== undefined)
217
+ .map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
218
+ .join('&');
219
+ let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
220
+ let localVarRequestOptions = {
221
+ method: 'DELETE',
222
+ headers: { ...localVarHeaderParams },
223
+ };
224
+ let requestOptions = localVarRequestOptions;
225
+ let url = localVarUrl;
226
+ const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
227
+ requestOptions = auth_ApiKeyAuthentication.requestOptions;
228
+ url = auth_ApiKeyAuthentication.url;
229
+ const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
230
+ requestOptions = auth_JWTAuthentication.requestOptions;
231
+ url = auth_JWTAuthentication.url;
232
+ const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
233
+ requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
234
+ url = auth_JWTHttpHeaderAuthentication.url;
235
+ const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
236
+ requestOptions = auth_OAuth2.requestOptions;
237
+ url = auth_OAuth2.url;
238
+ const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
239
+ requestOptions = authDefault.requestOptions;
240
+ url = authDefault.url;
241
+ (0, models_1.applyFormParams)(requestOptions, localVarFormParams);
242
+ const response = await fetch(url, requestOptions);
243
+ const resp = this.handleResponse(response, 'GenericApiResponse');
244
+ if (options === null || options === void 0 ? void 0 : options.responseHeadersCallback) {
245
+ const headerCb = options.responseHeadersCallback;
246
+ // on next tick, so we have time to handle the response
247
+ setTimeout(() => {
248
+ headerCb(Object.fromEntries(response.headers.entries()));
249
+ }, 0);
250
+ }
251
+ return resp;
252
+ }
253
+ /**
254
+ * Deletes the logo of an OAuth app owned by the developer profile organization.
255
+ * @summary Delete an OAuth app logo
256
+ * @param organizationId Organization ID
257
+ * @param oauthClientId
258
+ */
259
+ async deleteOrganizationOAuthClientLogo(organizationId, oauthClientId, options = { headers: {} }) {
260
+ const localVarPath = this.basePath + '/api/organizations/{organizationId}/oauth-clients/{oauthClientId}/logo'
261
+ .replace('{' + 'organizationId' + '}', encodeURIComponent(String(organizationId)))
262
+ .replace('{' + 'oauthClientId' + '}', encodeURIComponent(String(oauthClientId)));
263
+ let queryParameters = {};
264
+ let localVarHeaderParams = {
265
+ 'User-Agent': 'edgeimpulse-api nodejs',
266
+ 'Content-Type': 'application/json',
267
+ ...this.defaultHeaders,
268
+ };
269
+ const produces = ['application/json'];
270
+ // give precedence to 'application/json'
271
+ if (produces.indexOf('application/json') >= 0) {
272
+ localVarHeaderParams.Accept = 'application/json';
273
+ }
274
+ else {
275
+ localVarHeaderParams.Accept = produces.join(',');
276
+ }
277
+ let localVarFormParams;
278
+ // verify required parameter 'organizationId' is not null or undefined
279
+ if (organizationId === null || organizationId === undefined) {
280
+ throw new Error('Required parameter organizationId was null or undefined when calling deleteOrganizationOAuthClientLogo.');
281
+ }
282
+ // verify required parameter 'oauthClientId' is not null or undefined
283
+ if (oauthClientId === null || oauthClientId === undefined) {
284
+ throw new Error('Required parameter oauthClientId was null or undefined when calling deleteOrganizationOAuthClientLogo.');
285
+ }
286
+ localVarHeaderParams = {
287
+ ...localVarHeaderParams,
288
+ ...options.headers,
289
+ ...this.opts.extraHeaders,
290
+ };
291
+ const queryString = Object.entries(queryParameters)
292
+ .filter(([, value]) => value !== undefined)
293
+ .map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
294
+ .join('&');
295
+ let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
296
+ let localVarRequestOptions = {
297
+ method: 'DELETE',
298
+ headers: { ...localVarHeaderParams },
299
+ };
300
+ let requestOptions = localVarRequestOptions;
301
+ let url = localVarUrl;
302
+ const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
303
+ requestOptions = auth_ApiKeyAuthentication.requestOptions;
304
+ url = auth_ApiKeyAuthentication.url;
305
+ const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
306
+ requestOptions = auth_JWTAuthentication.requestOptions;
307
+ url = auth_JWTAuthentication.url;
308
+ const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
309
+ requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
310
+ url = auth_JWTHttpHeaderAuthentication.url;
311
+ const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
312
+ requestOptions = auth_OAuth2.requestOptions;
313
+ url = auth_OAuth2.url;
314
+ const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
315
+ requestOptions = authDefault.requestOptions;
316
+ url = authDefault.url;
317
+ (0, models_1.applyFormParams)(requestOptions, localVarFormParams);
318
+ const response = await fetch(url, requestOptions);
319
+ const resp = this.handleResponse(response, 'GenericApiResponse');
320
+ if (options === null || options === void 0 ? void 0 : options.responseHeadersCallback) {
321
+ const headerCb = options.responseHeadersCallback;
322
+ // on next tick, so we have time to handle the response
323
+ setTimeout(() => {
324
+ headerCb(Object.fromEntries(response.headers.entries()));
325
+ }, 0);
326
+ }
327
+ return resp;
328
+ }
329
+ /**
330
+ * Retrieves a single OAuth app owned by the developer profile organization.
331
+ * @summary Get an OAuth app
332
+ * @param organizationId Organization ID
333
+ * @param oauthClientId
334
+ */
335
+ async getOrganizationOAuthClient(organizationId, oauthClientId, options = { headers: {} }) {
336
+ const localVarPath = this.basePath + '/api/organizations/{organizationId}/oauth-clients/{oauthClientId}'
337
+ .replace('{' + 'organizationId' + '}', encodeURIComponent(String(organizationId)))
338
+ .replace('{' + 'oauthClientId' + '}', encodeURIComponent(String(oauthClientId)));
339
+ let queryParameters = {};
340
+ let localVarHeaderParams = {
341
+ 'User-Agent': 'edgeimpulse-api nodejs',
342
+ 'Content-Type': 'application/json',
343
+ ...this.defaultHeaders,
344
+ };
345
+ const produces = ['application/json'];
346
+ // give precedence to 'application/json'
347
+ if (produces.indexOf('application/json') >= 0) {
348
+ localVarHeaderParams.Accept = 'application/json';
349
+ }
350
+ else {
351
+ localVarHeaderParams.Accept = produces.join(',');
352
+ }
353
+ let localVarFormParams;
354
+ // verify required parameter 'organizationId' is not null or undefined
355
+ if (organizationId === null || organizationId === undefined) {
356
+ throw new Error('Required parameter organizationId was null or undefined when calling getOrganizationOAuthClient.');
357
+ }
358
+ // verify required parameter 'oauthClientId' is not null or undefined
359
+ if (oauthClientId === null || oauthClientId === undefined) {
360
+ throw new Error('Required parameter oauthClientId was null or undefined when calling getOrganizationOAuthClient.');
361
+ }
362
+ localVarHeaderParams = {
363
+ ...localVarHeaderParams,
364
+ ...options.headers,
365
+ ...this.opts.extraHeaders,
366
+ };
367
+ const queryString = Object.entries(queryParameters)
368
+ .filter(([, value]) => value !== undefined)
369
+ .map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
370
+ .join('&');
371
+ let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
372
+ let localVarRequestOptions = {
373
+ method: 'GET',
374
+ headers: { ...localVarHeaderParams },
375
+ };
376
+ let requestOptions = localVarRequestOptions;
377
+ let url = localVarUrl;
378
+ const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
379
+ requestOptions = auth_ApiKeyAuthentication.requestOptions;
380
+ url = auth_ApiKeyAuthentication.url;
381
+ const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
382
+ requestOptions = auth_JWTAuthentication.requestOptions;
383
+ url = auth_JWTAuthentication.url;
384
+ const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
385
+ requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
386
+ url = auth_JWTHttpHeaderAuthentication.url;
387
+ const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
388
+ requestOptions = auth_OAuth2.requestOptions;
389
+ url = auth_OAuth2.url;
390
+ const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
391
+ requestOptions = authDefault.requestOptions;
392
+ url = authDefault.url;
393
+ (0, models_1.applyFormParams)(requestOptions, localVarFormParams);
394
+ const response = await fetch(url, requestOptions);
395
+ const resp = this.handleResponse(response, 'GetOrganizationOAuthClientResponse');
396
+ if (options === null || options === void 0 ? void 0 : options.responseHeadersCallback) {
397
+ const headerCb = options.responseHeadersCallback;
398
+ // on next tick, so we have time to handle the response
399
+ setTimeout(() => {
400
+ headerCb(Object.fromEntries(response.headers.entries()));
401
+ }, 0);
402
+ }
403
+ return resp;
404
+ }
405
+ /**
406
+ * Lists the OAuth apps owned by the developer profile organization.
407
+ * @summary List OAuth apps
408
+ * @param organizationId Organization ID
409
+ */
410
+ async listOrganizationOAuthClients(organizationId, options = { headers: {} }) {
411
+ const localVarPath = this.basePath + '/api/organizations/{organizationId}/oauth-clients'
412
+ .replace('{' + 'organizationId' + '}', encodeURIComponent(String(organizationId)));
413
+ let queryParameters = {};
414
+ let localVarHeaderParams = {
415
+ 'User-Agent': 'edgeimpulse-api nodejs',
416
+ 'Content-Type': 'application/json',
417
+ ...this.defaultHeaders,
418
+ };
419
+ const produces = ['application/json'];
420
+ // give precedence to 'application/json'
421
+ if (produces.indexOf('application/json') >= 0) {
422
+ localVarHeaderParams.Accept = 'application/json';
423
+ }
424
+ else {
425
+ localVarHeaderParams.Accept = produces.join(',');
426
+ }
427
+ let localVarFormParams;
428
+ // verify required parameter 'organizationId' is not null or undefined
429
+ if (organizationId === null || organizationId === undefined) {
430
+ throw new Error('Required parameter organizationId was null or undefined when calling listOrganizationOAuthClients.');
431
+ }
432
+ localVarHeaderParams = {
433
+ ...localVarHeaderParams,
434
+ ...options.headers,
435
+ ...this.opts.extraHeaders,
436
+ };
437
+ const queryString = Object.entries(queryParameters)
438
+ .filter(([, value]) => value !== undefined)
439
+ .map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
440
+ .join('&');
441
+ let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
442
+ let localVarRequestOptions = {
443
+ method: 'GET',
444
+ headers: { ...localVarHeaderParams },
445
+ };
446
+ let requestOptions = localVarRequestOptions;
447
+ let url = localVarUrl;
448
+ const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
449
+ requestOptions = auth_ApiKeyAuthentication.requestOptions;
450
+ url = auth_ApiKeyAuthentication.url;
451
+ const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
452
+ requestOptions = auth_JWTAuthentication.requestOptions;
453
+ url = auth_JWTAuthentication.url;
454
+ const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
455
+ requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
456
+ url = auth_JWTHttpHeaderAuthentication.url;
457
+ const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
458
+ requestOptions = auth_OAuth2.requestOptions;
459
+ url = auth_OAuth2.url;
460
+ const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
461
+ requestOptions = authDefault.requestOptions;
462
+ url = authDefault.url;
463
+ (0, models_1.applyFormParams)(requestOptions, localVarFormParams);
464
+ const response = await fetch(url, requestOptions);
465
+ const resp = this.handleResponse(response, 'ListOrganizationOAuthClientsResponse');
466
+ if (options === null || options === void 0 ? void 0 : options.responseHeadersCallback) {
467
+ const headerCb = options.responseHeadersCallback;
468
+ // on next tick, so we have time to handle the response
469
+ setTimeout(() => {
470
+ headerCb(Object.fromEntries(response.headers.entries()));
471
+ }, 0);
472
+ }
473
+ return resp;
474
+ }
475
+ /**
476
+ * Rotates the client secret of an OAuth app owned by the developer profile organization and returns the new one-time secret.
477
+ * @summary Rotate an OAuth app client secret
478
+ * @param organizationId Organization ID
479
+ * @param oauthClientId
480
+ */
481
+ async rotateOrganizationOAuthClientSecret(organizationId, oauthClientId, options = { headers: {} }) {
482
+ const localVarPath = this.basePath + '/api/organizations/{organizationId}/oauth-clients/{oauthClientId}/rotate-secret'
483
+ .replace('{' + 'organizationId' + '}', encodeURIComponent(String(organizationId)))
484
+ .replace('{' + 'oauthClientId' + '}', encodeURIComponent(String(oauthClientId)));
485
+ let queryParameters = {};
486
+ let localVarHeaderParams = {
487
+ 'User-Agent': 'edgeimpulse-api nodejs',
488
+ 'Content-Type': 'application/json',
489
+ ...this.defaultHeaders,
490
+ };
491
+ const produces = ['application/json'];
492
+ // give precedence to 'application/json'
493
+ if (produces.indexOf('application/json') >= 0) {
494
+ localVarHeaderParams.Accept = 'application/json';
495
+ }
496
+ else {
497
+ localVarHeaderParams.Accept = produces.join(',');
498
+ }
499
+ let localVarFormParams;
500
+ // verify required parameter 'organizationId' is not null or undefined
501
+ if (organizationId === null || organizationId === undefined) {
502
+ throw new Error('Required parameter organizationId was null or undefined when calling rotateOrganizationOAuthClientSecret.');
503
+ }
504
+ // verify required parameter 'oauthClientId' is not null or undefined
505
+ if (oauthClientId === null || oauthClientId === undefined) {
506
+ throw new Error('Required parameter oauthClientId was null or undefined when calling rotateOrganizationOAuthClientSecret.');
507
+ }
508
+ localVarHeaderParams = {
509
+ ...localVarHeaderParams,
510
+ ...options.headers,
511
+ ...this.opts.extraHeaders,
512
+ };
513
+ const queryString = Object.entries(queryParameters)
514
+ .filter(([, value]) => value !== undefined)
515
+ .map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
516
+ .join('&');
517
+ let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
518
+ let localVarRequestOptions = {
519
+ method: 'POST',
520
+ headers: { ...localVarHeaderParams },
521
+ };
522
+ let requestOptions = localVarRequestOptions;
523
+ let url = localVarUrl;
524
+ const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
525
+ requestOptions = auth_ApiKeyAuthentication.requestOptions;
526
+ url = auth_ApiKeyAuthentication.url;
527
+ const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
528
+ requestOptions = auth_JWTAuthentication.requestOptions;
529
+ url = auth_JWTAuthentication.url;
530
+ const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
531
+ requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
532
+ url = auth_JWTHttpHeaderAuthentication.url;
533
+ const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
534
+ requestOptions = auth_OAuth2.requestOptions;
535
+ url = auth_OAuth2.url;
536
+ const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
537
+ requestOptions = authDefault.requestOptions;
538
+ url = authDefault.url;
539
+ (0, models_1.applyFormParams)(requestOptions, localVarFormParams);
540
+ const response = await fetch(url, requestOptions);
541
+ const resp = this.handleResponse(response, 'RotateOAuthClientSecretResponse');
542
+ if (options === null || options === void 0 ? void 0 : options.responseHeadersCallback) {
543
+ const headerCb = options.responseHeadersCallback;
544
+ // on next tick, so we have time to handle the response
545
+ setTimeout(() => {
546
+ headerCb(Object.fromEntries(response.headers.entries()));
547
+ }, 0);
548
+ }
549
+ return resp;
550
+ }
551
+ /**
552
+ * Updates the mutable properties of an OAuth app owned by the developer profile organization.
553
+ * @summary Update an OAuth app
554
+ * @param organizationId Organization ID
555
+ * @param oauthClientId
556
+ * @param updateOAuthClientRequest
557
+ */
558
+ async updateOrganizationOAuthClient(organizationId, oauthClientId, updateOAuthClientRequest, options = { headers: {} }) {
559
+ const localVarPath = this.basePath + '/api/organizations/{organizationId}/oauth-clients/{oauthClientId}'
560
+ .replace('{' + 'organizationId' + '}', encodeURIComponent(String(organizationId)))
561
+ .replace('{' + 'oauthClientId' + '}', encodeURIComponent(String(oauthClientId)));
562
+ let queryParameters = {};
563
+ let localVarHeaderParams = {
564
+ 'User-Agent': 'edgeimpulse-api nodejs',
565
+ 'Content-Type': 'application/json',
566
+ ...this.defaultHeaders,
567
+ };
568
+ const produces = ['application/json'];
569
+ // give precedence to 'application/json'
570
+ if (produces.indexOf('application/json') >= 0) {
571
+ localVarHeaderParams.Accept = 'application/json';
572
+ }
573
+ else {
574
+ localVarHeaderParams.Accept = produces.join(',');
575
+ }
576
+ let localVarFormParams;
577
+ // verify required parameter 'organizationId' is not null or undefined
578
+ if (organizationId === null || organizationId === undefined) {
579
+ throw new Error('Required parameter organizationId was null or undefined when calling updateOrganizationOAuthClient.');
580
+ }
581
+ // verify required parameter 'oauthClientId' is not null or undefined
582
+ if (oauthClientId === null || oauthClientId === undefined) {
583
+ throw new Error('Required parameter oauthClientId was null or undefined when calling updateOrganizationOAuthClient.');
584
+ }
585
+ // verify required parameter 'updateOAuthClientRequest' is not null or undefined
586
+ if (updateOAuthClientRequest === null || updateOAuthClientRequest === undefined) {
587
+ throw new Error('Required parameter updateOAuthClientRequest was null or undefined when calling updateOrganizationOAuthClient.');
588
+ }
589
+ localVarHeaderParams = {
590
+ ...localVarHeaderParams,
591
+ ...options.headers,
592
+ ...this.opts.extraHeaders,
593
+ };
594
+ const queryString = Object.entries(queryParameters)
595
+ .filter(([, value]) => value !== undefined)
596
+ .map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
597
+ .join('&');
598
+ let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
599
+ let localVarRequestOptions = {
600
+ method: 'POST',
601
+ headers: { ...localVarHeaderParams },
602
+ };
603
+ localVarRequestOptions.body = JSON.stringify(updateOAuthClientRequest);
604
+ let requestOptions = localVarRequestOptions;
605
+ let url = localVarUrl;
606
+ const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
607
+ requestOptions = auth_ApiKeyAuthentication.requestOptions;
608
+ url = auth_ApiKeyAuthentication.url;
609
+ const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
610
+ requestOptions = auth_JWTAuthentication.requestOptions;
611
+ url = auth_JWTAuthentication.url;
612
+ const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
613
+ requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
614
+ url = auth_JWTHttpHeaderAuthentication.url;
615
+ const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
616
+ requestOptions = auth_OAuth2.requestOptions;
617
+ url = auth_OAuth2.url;
618
+ const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
619
+ requestOptions = authDefault.requestOptions;
620
+ url = authDefault.url;
621
+ (0, models_1.applyFormParams)(requestOptions, localVarFormParams);
622
+ const response = await fetch(url, requestOptions);
623
+ const resp = this.handleResponse(response, 'GenericApiResponse');
624
+ if (options === null || options === void 0 ? void 0 : options.responseHeadersCallback) {
625
+ const headerCb = options.responseHeadersCallback;
626
+ // on next tick, so we have time to handle the response
627
+ setTimeout(() => {
628
+ headerCb(Object.fromEntries(response.headers.entries()));
629
+ }, 0);
630
+ }
631
+ return resp;
632
+ }
633
+ /**
634
+ * Uploads a PNG or JPEG logo for an OAuth app owned by the developer profile organization.
635
+ * @summary Upload an OAuth app logo
636
+ * @param organizationId Organization ID
637
+ * @param oauthClientId
638
+ * @param image
639
+ */
640
+ async uploadOrganizationOAuthClientLogo(organizationId, oauthClientId, params, options = { headers: {} }) {
641
+ const localVarPath = this.basePath + '/api/organizations/{organizationId}/oauth-clients/{oauthClientId}/logo'
642
+ .replace('{' + 'organizationId' + '}', encodeURIComponent(String(organizationId)))
643
+ .replace('{' + 'oauthClientId' + '}', encodeURIComponent(String(oauthClientId)));
644
+ let queryParameters = {};
645
+ let localVarHeaderParams = {
646
+ 'User-Agent': 'edgeimpulse-api nodejs',
647
+ 'Content-Type': 'application/json',
648
+ ...this.defaultHeaders,
649
+ };
650
+ const produces = ['application/json'];
651
+ // give precedence to 'application/json'
652
+ if (produces.indexOf('application/json') >= 0) {
653
+ localVarHeaderParams.Accept = 'application/json';
654
+ }
655
+ else {
656
+ localVarHeaderParams.Accept = produces.join(',');
657
+ }
658
+ let localVarFormParams;
659
+ // verify required parameter 'organizationId' is not null or undefined
660
+ if (organizationId === null || organizationId === undefined) {
661
+ throw new Error('Required parameter organizationId was null or undefined when calling uploadOrganizationOAuthClientLogo.');
662
+ }
663
+ // verify required parameter 'oauthClientId' is not null or undefined
664
+ if (oauthClientId === null || oauthClientId === undefined) {
665
+ throw new Error('Required parameter oauthClientId was null or undefined when calling uploadOrganizationOAuthClientLogo.');
666
+ }
667
+ // verify required parameter 'image' is not null or undefined
668
+ if (params.image === null || params.image === undefined) {
669
+ throw new Error('Required parameter params.image was null or undefined when calling uploadOrganizationOAuthClientLogo.');
670
+ }
671
+ localVarHeaderParams = {
672
+ ...localVarHeaderParams,
673
+ ...options.headers,
674
+ ...this.opts.extraHeaders,
675
+ };
676
+ if (params.image !== undefined) {
677
+ localVarFormParams = (0, models_1.ensureFormData)(localVarFormParams);
678
+ const imageFiles = Array.isArray(params.image) ? params.image : [params.image];
679
+ const Blob = globalThis.Blob || require('buffer').Blob;
680
+ for (const f of imageFiles) {
681
+ localVarFormParams.append('image', new Blob([new Uint8Array(f.value)], {
682
+ type: f.options.contentType
683
+ }), f.options.filename);
684
+ }
685
+ }
686
+ const queryString = Object.entries(queryParameters)
687
+ .filter(([, value]) => value !== undefined)
688
+ .map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
689
+ .join('&');
690
+ let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
691
+ let localVarRequestOptions = {
692
+ method: 'POST',
693
+ headers: { ...localVarHeaderParams },
694
+ };
695
+ let requestOptions = localVarRequestOptions;
696
+ let url = localVarUrl;
697
+ const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
698
+ requestOptions = auth_ApiKeyAuthentication.requestOptions;
699
+ url = auth_ApiKeyAuthentication.url;
700
+ const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
701
+ requestOptions = auth_JWTAuthentication.requestOptions;
702
+ url = auth_JWTAuthentication.url;
703
+ const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
704
+ requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
705
+ url = auth_JWTHttpHeaderAuthentication.url;
706
+ const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
707
+ requestOptions = auth_OAuth2.requestOptions;
708
+ url = auth_OAuth2.url;
709
+ const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
710
+ requestOptions = authDefault.requestOptions;
711
+ url = authDefault.url;
712
+ (0, models_1.applyFormParams)(requestOptions, localVarFormParams);
713
+ const response = await fetch(url, requestOptions);
714
+ const resp = this.handleResponse(response, 'GenericApiResponse');
715
+ if (options === null || options === void 0 ? void 0 : options.responseHeadersCallback) {
716
+ const headerCb = options.responseHeadersCallback;
717
+ // on next tick, so we have time to handle the response
718
+ setTimeout(() => {
719
+ headerCb(Object.fromEntries(response.headers.entries()));
720
+ }, 0);
721
+ }
722
+ return resp;
723
+ }
724
+ }
725
+ exports.OrganizationOAuthClientsApi = OrganizationOAuthClientsApi;
726
+ //# sourceMappingURL=organizationOAuthClientsApi.js.map