edge-impulse-api 1.93.10 → 1.93.12

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 (64) hide show
  1. package/build/browser/edge-impulse-api.d.ts +508 -2
  2. package/build/browser/edge-impulse-api.js +1250 -130
  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/monitoringApi.d.ts +204 -0
  8. package/build/library/sdk/api/monitoringApi.js +985 -0
  9. package/build/library/sdk/api/monitoringApi.js.map +1 -0
  10. package/build/library/sdk/model/createEventSubscriptionRequest.d.ts +24 -0
  11. package/build/library/sdk/model/createEventSubscriptionRequest.js +4 -0
  12. package/build/library/sdk/model/createEventSubscriptionRequest.js.map +1 -0
  13. package/build/library/sdk/model/createEventSubscriptionResponse.d.ts +12 -0
  14. package/build/library/sdk/model/createEventSubscriptionResponse.js +4 -0
  15. package/build/library/sdk/model/createEventSubscriptionResponse.js.map +1 -0
  16. package/build/library/sdk/model/createWebhookDestinationRequest.d.ts +10 -0
  17. package/build/library/sdk/model/createWebhookDestinationRequest.js +4 -0
  18. package/build/library/sdk/model/createWebhookDestinationRequest.js.map +1 -0
  19. package/build/library/sdk/model/createWebhookDestinationResponse.d.ts +20 -0
  20. package/build/library/sdk/model/createWebhookDestinationResponse.js +4 -0
  21. package/build/library/sdk/model/createWebhookDestinationResponse.js.map +1 -0
  22. package/build/library/sdk/model/eventSubscription.d.ts +32 -0
  23. package/build/library/sdk/model/eventSubscription.js +4 -0
  24. package/build/library/sdk/model/eventSubscription.js.map +1 -0
  25. package/build/library/sdk/model/getEventSubscriptionResponse.d.ts +12 -0
  26. package/build/library/sdk/model/getEventSubscriptionResponse.js +4 -0
  27. package/build/library/sdk/model/getEventSubscriptionResponse.js.map +1 -0
  28. package/build/library/sdk/model/getWebhookDestinationResponse.d.ts +12 -0
  29. package/build/library/sdk/model/getWebhookDestinationResponse.js +4 -0
  30. package/build/library/sdk/model/getWebhookDestinationResponse.js.map +1 -0
  31. package/build/library/sdk/model/listEventSubscriptionsResponse.d.ts +12 -0
  32. package/build/library/sdk/model/listEventSubscriptionsResponse.js +4 -0
  33. package/build/library/sdk/model/listEventSubscriptionsResponse.js.map +1 -0
  34. package/build/library/sdk/model/listMonitoringEventsResponse.d.ts +12 -0
  35. package/build/library/sdk/model/listMonitoringEventsResponse.js +4 -0
  36. package/build/library/sdk/model/listMonitoringEventsResponse.js.map +1 -0
  37. package/build/library/sdk/model/listWebhookDestinationsResponse.d.ts +12 -0
  38. package/build/library/sdk/model/listWebhookDestinationsResponse.js +4 -0
  39. package/build/library/sdk/model/listWebhookDestinationsResponse.js.map +1 -0
  40. package/build/library/sdk/model/models.d.ts +16 -0
  41. package/build/library/sdk/model/models.js +16 -0
  42. package/build/library/sdk/model/models.js.map +1 -1
  43. package/build/library/sdk/model/monitoringEvent.d.ts +34 -0
  44. package/build/library/sdk/model/monitoringEvent.js +6 -0
  45. package/build/library/sdk/model/monitoringEvent.js.map +1 -0
  46. package/build/library/sdk/model/oAuthScope.d.ts +1 -1
  47. package/build/library/sdk/model/oAuthScope.js +1 -1
  48. package/build/library/sdk/model/oAuthScope.js.map +1 -1
  49. package/build/library/sdk/model/rotateWebhookDestinationSecretResponse.d.ts +15 -0
  50. package/build/library/sdk/model/rotateWebhookDestinationSecretResponse.js +4 -0
  51. package/build/library/sdk/model/rotateWebhookDestinationSecretResponse.js.map +1 -0
  52. package/build/library/sdk/model/testWebhookDestinationResponse.d.ts +20 -0
  53. package/build/library/sdk/model/testWebhookDestinationResponse.js +4 -0
  54. package/build/library/sdk/model/testWebhookDestinationResponse.js.map +1 -0
  55. package/build/library/sdk/model/updateEventSubscriptionRequest.d.ts +24 -0
  56. package/build/library/sdk/model/updateEventSubscriptionRequest.js +4 -0
  57. package/build/library/sdk/model/updateEventSubscriptionRequest.js.map +1 -0
  58. package/build/library/sdk/model/updateWebhookDestinationRequest.d.ts +14 -0
  59. package/build/library/sdk/model/updateWebhookDestinationRequest.js +4 -0
  60. package/build/library/sdk/model/updateWebhookDestinationRequest.js.map +1 -0
  61. package/build/library/sdk/model/webhookDestination.d.ts +26 -0
  62. package/build/library/sdk/model/webhookDestination.js +4 -0
  63. package/build/library/sdk/model/webhookDestination.js.map +1 -0
  64. package/package.json +1 -1
@@ -0,0 +1,985 @@
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.MonitoringApi = exports.MonitoringApiApiKeys = 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 MonitoringApiApiKeys;
33
+ (function (MonitoringApiApiKeys) {
34
+ MonitoringApiApiKeys[MonitoringApiApiKeys["ApiKeyAuthentication"] = 0] = "ApiKeyAuthentication";
35
+ MonitoringApiApiKeys[MonitoringApiApiKeys["JWTAuthentication"] = 1] = "JWTAuthentication";
36
+ MonitoringApiApiKeys[MonitoringApiApiKeys["JWTHttpHeaderAuthentication"] = 2] = "JWTHttpHeaderAuthentication";
37
+ })(MonitoringApiApiKeys = exports.MonitoringApiApiKeys || (exports.MonitoringApiApiKeys = {}));
38
+ class MonitoringApi {
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[MonitoringApiApiKeys[key]].apiKey = value;
97
+ }
98
+ set accessToken(token) {
99
+ this.authentications.OAuth2.accessToken = token;
100
+ }
101
+ /**
102
+ * Create a monitoring event subscription for this project.
103
+ * @summary Create event subscription
104
+ * @param projectId Project ID
105
+ * @param createEventSubscriptionRequest
106
+ */
107
+ async createEventSubscription(projectId, createEventSubscriptionRequest, options = { headers: {} }) {
108
+ const localVarPath = this.basePath + '/api/{projectId}/monitoring/event-subscriptions'
109
+ .replace('{' + 'projectId' + '}', encodeURIComponent(String(projectId)));
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 'projectId' is not null or undefined
126
+ if (projectId === null || projectId === undefined) {
127
+ throw new Error('Required parameter projectId was null or undefined when calling createEventSubscription.');
128
+ }
129
+ // verify required parameter 'createEventSubscriptionRequest' is not null or undefined
130
+ if (createEventSubscriptionRequest === null || createEventSubscriptionRequest === undefined) {
131
+ throw new Error('Required parameter createEventSubscriptionRequest was null or undefined when calling createEventSubscription.');
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(createEventSubscriptionRequest);
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
+ return this.handleResponse(response, 'CreateEventSubscriptionResponse');
168
+ }
169
+ /**
170
+ * Create a new webhook destination for this project.
171
+ * @summary Create a new webhook destination
172
+ * @param projectId Project ID
173
+ * @param createWebhookDestinationRequest
174
+ */
175
+ async createWebhookDestination(projectId, createWebhookDestinationRequest, options = { headers: {} }) {
176
+ const localVarPath = this.basePath + '/api/{projectId}/monitoring/webhooks'
177
+ .replace('{' + 'projectId' + '}', encodeURIComponent(String(projectId)));
178
+ let queryParameters = {};
179
+ let localVarHeaderParams = {
180
+ 'User-Agent': 'edgeimpulse-api nodejs',
181
+ 'Content-Type': 'application/json',
182
+ ...this.defaultHeaders,
183
+ };
184
+ const produces = ['application/json'];
185
+ // give precedence to 'application/json'
186
+ if (produces.indexOf('application/json') >= 0) {
187
+ localVarHeaderParams.Accept = 'application/json';
188
+ }
189
+ else {
190
+ localVarHeaderParams.Accept = produces.join(',');
191
+ }
192
+ let localVarFormParams;
193
+ // verify required parameter 'projectId' is not null or undefined
194
+ if (projectId === null || projectId === undefined) {
195
+ throw new Error('Required parameter projectId was null or undefined when calling createWebhookDestination.');
196
+ }
197
+ // verify required parameter 'createWebhookDestinationRequest' is not null or undefined
198
+ if (createWebhookDestinationRequest === null || createWebhookDestinationRequest === undefined) {
199
+ throw new Error('Required parameter createWebhookDestinationRequest was null or undefined when calling createWebhookDestination.');
200
+ }
201
+ localVarHeaderParams = {
202
+ ...localVarHeaderParams,
203
+ ...options.headers,
204
+ ...this.opts.extraHeaders,
205
+ };
206
+ const queryString = Object.entries(queryParameters)
207
+ .filter(([, value]) => value !== undefined)
208
+ .map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
209
+ .join('&');
210
+ let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
211
+ let localVarRequestOptions = {
212
+ method: 'POST',
213
+ headers: { ...localVarHeaderParams },
214
+ };
215
+ localVarRequestOptions.body = JSON.stringify(createWebhookDestinationRequest);
216
+ let requestOptions = localVarRequestOptions;
217
+ let url = localVarUrl;
218
+ const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
219
+ requestOptions = auth_ApiKeyAuthentication.requestOptions;
220
+ url = auth_ApiKeyAuthentication.url;
221
+ const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
222
+ requestOptions = auth_JWTAuthentication.requestOptions;
223
+ url = auth_JWTAuthentication.url;
224
+ const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
225
+ requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
226
+ url = auth_JWTHttpHeaderAuthentication.url;
227
+ const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
228
+ requestOptions = auth_OAuth2.requestOptions;
229
+ url = auth_OAuth2.url;
230
+ const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
231
+ requestOptions = authDefault.requestOptions;
232
+ url = authDefault.url;
233
+ (0, models_1.applyFormParams)(requestOptions, localVarFormParams);
234
+ const response = await fetch(url, requestOptions);
235
+ return this.handleResponse(response, 'CreateWebhookDestinationResponse');
236
+ }
237
+ /**
238
+ * Delete a monitoring event subscription.
239
+ * @summary Delete event subscription
240
+ * @param projectId Project ID
241
+ * @param eventSubscriptionId Event subscription ID
242
+ */
243
+ async deleteEventSubscription(projectId, eventSubscriptionId, options = { headers: {} }) {
244
+ const localVarPath = this.basePath + '/api/{projectId}/monitoring/event-subscriptions/{eventSubscriptionId}'
245
+ .replace('{' + 'projectId' + '}', encodeURIComponent(String(projectId)))
246
+ .replace('{' + 'eventSubscriptionId' + '}', encodeURIComponent(String(eventSubscriptionId)));
247
+ let queryParameters = {};
248
+ let localVarHeaderParams = {
249
+ 'User-Agent': 'edgeimpulse-api nodejs',
250
+ 'Content-Type': 'application/json',
251
+ ...this.defaultHeaders,
252
+ };
253
+ const produces = ['application/json'];
254
+ // give precedence to 'application/json'
255
+ if (produces.indexOf('application/json') >= 0) {
256
+ localVarHeaderParams.Accept = 'application/json';
257
+ }
258
+ else {
259
+ localVarHeaderParams.Accept = produces.join(',');
260
+ }
261
+ let localVarFormParams;
262
+ // verify required parameter 'projectId' is not null or undefined
263
+ if (projectId === null || projectId === undefined) {
264
+ throw new Error('Required parameter projectId was null or undefined when calling deleteEventSubscription.');
265
+ }
266
+ // verify required parameter 'eventSubscriptionId' is not null or undefined
267
+ if (eventSubscriptionId === null || eventSubscriptionId === undefined) {
268
+ throw new Error('Required parameter eventSubscriptionId was null or undefined when calling deleteEventSubscription.');
269
+ }
270
+ localVarHeaderParams = {
271
+ ...localVarHeaderParams,
272
+ ...options.headers,
273
+ ...this.opts.extraHeaders,
274
+ };
275
+ const queryString = Object.entries(queryParameters)
276
+ .filter(([, value]) => value !== undefined)
277
+ .map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
278
+ .join('&');
279
+ let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
280
+ let localVarRequestOptions = {
281
+ method: 'DELETE',
282
+ headers: { ...localVarHeaderParams },
283
+ };
284
+ let requestOptions = localVarRequestOptions;
285
+ let url = localVarUrl;
286
+ const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
287
+ requestOptions = auth_ApiKeyAuthentication.requestOptions;
288
+ url = auth_ApiKeyAuthentication.url;
289
+ const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
290
+ requestOptions = auth_JWTAuthentication.requestOptions;
291
+ url = auth_JWTAuthentication.url;
292
+ const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
293
+ requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
294
+ url = auth_JWTHttpHeaderAuthentication.url;
295
+ const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
296
+ requestOptions = auth_OAuth2.requestOptions;
297
+ url = auth_OAuth2.url;
298
+ const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
299
+ requestOptions = authDefault.requestOptions;
300
+ url = authDefault.url;
301
+ (0, models_1.applyFormParams)(requestOptions, localVarFormParams);
302
+ const response = await fetch(url, requestOptions);
303
+ return this.handleResponse(response, 'GenericApiResponse');
304
+ }
305
+ /**
306
+ * Delete a webhook destination.
307
+ * @summary Delete webhook destination
308
+ * @param projectId Project ID
309
+ * @param webhookId Webhook destination ID
310
+ */
311
+ async deleteWebhookDestination(projectId, webhookId, options = { headers: {} }) {
312
+ const localVarPath = this.basePath + '/api/{projectId}/monitoring/webhooks/{webhookId}'
313
+ .replace('{' + 'projectId' + '}', encodeURIComponent(String(projectId)))
314
+ .replace('{' + 'webhookId' + '}', encodeURIComponent(String(webhookId)));
315
+ let queryParameters = {};
316
+ let localVarHeaderParams = {
317
+ 'User-Agent': 'edgeimpulse-api nodejs',
318
+ 'Content-Type': 'application/json',
319
+ ...this.defaultHeaders,
320
+ };
321
+ const produces = ['application/json'];
322
+ // give precedence to 'application/json'
323
+ if (produces.indexOf('application/json') >= 0) {
324
+ localVarHeaderParams.Accept = 'application/json';
325
+ }
326
+ else {
327
+ localVarHeaderParams.Accept = produces.join(',');
328
+ }
329
+ let localVarFormParams;
330
+ // verify required parameter 'projectId' is not null or undefined
331
+ if (projectId === null || projectId === undefined) {
332
+ throw new Error('Required parameter projectId was null or undefined when calling deleteWebhookDestination.');
333
+ }
334
+ // verify required parameter 'webhookId' is not null or undefined
335
+ if (webhookId === null || webhookId === undefined) {
336
+ throw new Error('Required parameter webhookId was null or undefined when calling deleteWebhookDestination.');
337
+ }
338
+ localVarHeaderParams = {
339
+ ...localVarHeaderParams,
340
+ ...options.headers,
341
+ ...this.opts.extraHeaders,
342
+ };
343
+ const queryString = Object.entries(queryParameters)
344
+ .filter(([, value]) => value !== undefined)
345
+ .map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
346
+ .join('&');
347
+ let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
348
+ let localVarRequestOptions = {
349
+ method: 'DELETE',
350
+ headers: { ...localVarHeaderParams },
351
+ };
352
+ let requestOptions = localVarRequestOptions;
353
+ let url = localVarUrl;
354
+ const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
355
+ requestOptions = auth_ApiKeyAuthentication.requestOptions;
356
+ url = auth_ApiKeyAuthentication.url;
357
+ const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
358
+ requestOptions = auth_JWTAuthentication.requestOptions;
359
+ url = auth_JWTAuthentication.url;
360
+ const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
361
+ requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
362
+ url = auth_JWTHttpHeaderAuthentication.url;
363
+ const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
364
+ requestOptions = auth_OAuth2.requestOptions;
365
+ url = auth_OAuth2.url;
366
+ const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
367
+ requestOptions = authDefault.requestOptions;
368
+ url = authDefault.url;
369
+ (0, models_1.applyFormParams)(requestOptions, localVarFormParams);
370
+ const response = await fetch(url, requestOptions);
371
+ return this.handleResponse(response, 'GenericApiResponse');
372
+ }
373
+ /**
374
+ * Get details about a monitoring event subscription.
375
+ * @summary Get event subscription
376
+ * @param projectId Project ID
377
+ * @param eventSubscriptionId Event subscription ID
378
+ */
379
+ async getEventSubscription(projectId, eventSubscriptionId, options = { headers: {} }) {
380
+ const localVarPath = this.basePath + '/api/{projectId}/monitoring/event-subscriptions/{eventSubscriptionId}'
381
+ .replace('{' + 'projectId' + '}', encodeURIComponent(String(projectId)))
382
+ .replace('{' + 'eventSubscriptionId' + '}', encodeURIComponent(String(eventSubscriptionId)));
383
+ let queryParameters = {};
384
+ let localVarHeaderParams = {
385
+ 'User-Agent': 'edgeimpulse-api nodejs',
386
+ 'Content-Type': 'application/json',
387
+ ...this.defaultHeaders,
388
+ };
389
+ const produces = ['application/json'];
390
+ // give precedence to 'application/json'
391
+ if (produces.indexOf('application/json') >= 0) {
392
+ localVarHeaderParams.Accept = 'application/json';
393
+ }
394
+ else {
395
+ localVarHeaderParams.Accept = produces.join(',');
396
+ }
397
+ let localVarFormParams;
398
+ // verify required parameter 'projectId' is not null or undefined
399
+ if (projectId === null || projectId === undefined) {
400
+ throw new Error('Required parameter projectId was null or undefined when calling getEventSubscription.');
401
+ }
402
+ // verify required parameter 'eventSubscriptionId' is not null or undefined
403
+ if (eventSubscriptionId === null || eventSubscriptionId === undefined) {
404
+ throw new Error('Required parameter eventSubscriptionId was null or undefined when calling getEventSubscription.');
405
+ }
406
+ localVarHeaderParams = {
407
+ ...localVarHeaderParams,
408
+ ...options.headers,
409
+ ...this.opts.extraHeaders,
410
+ };
411
+ const queryString = Object.entries(queryParameters)
412
+ .filter(([, value]) => value !== undefined)
413
+ .map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
414
+ .join('&');
415
+ let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
416
+ let localVarRequestOptions = {
417
+ method: 'GET',
418
+ headers: { ...localVarHeaderParams },
419
+ };
420
+ let requestOptions = localVarRequestOptions;
421
+ let url = localVarUrl;
422
+ const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
423
+ requestOptions = auth_ApiKeyAuthentication.requestOptions;
424
+ url = auth_ApiKeyAuthentication.url;
425
+ const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
426
+ requestOptions = auth_JWTAuthentication.requestOptions;
427
+ url = auth_JWTAuthentication.url;
428
+ const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
429
+ requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
430
+ url = auth_JWTHttpHeaderAuthentication.url;
431
+ const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
432
+ requestOptions = auth_OAuth2.requestOptions;
433
+ url = auth_OAuth2.url;
434
+ const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
435
+ requestOptions = authDefault.requestOptions;
436
+ url = authDefault.url;
437
+ (0, models_1.applyFormParams)(requestOptions, localVarFormParams);
438
+ const response = await fetch(url, requestOptions);
439
+ return this.handleResponse(response, 'GetEventSubscriptionResponse');
440
+ }
441
+ /**
442
+ * Get details about a webhook destination.
443
+ * @summary Get webhook destination
444
+ * @param projectId Project ID
445
+ * @param webhookId Webhook destination ID
446
+ */
447
+ async getWebhookDestination(projectId, webhookId, options = { headers: {} }) {
448
+ const localVarPath = this.basePath + '/api/{projectId}/monitoring/webhooks/{webhookId}'
449
+ .replace('{' + 'projectId' + '}', encodeURIComponent(String(projectId)))
450
+ .replace('{' + 'webhookId' + '}', encodeURIComponent(String(webhookId)));
451
+ let queryParameters = {};
452
+ let localVarHeaderParams = {
453
+ 'User-Agent': 'edgeimpulse-api nodejs',
454
+ 'Content-Type': 'application/json',
455
+ ...this.defaultHeaders,
456
+ };
457
+ const produces = ['application/json'];
458
+ // give precedence to 'application/json'
459
+ if (produces.indexOf('application/json') >= 0) {
460
+ localVarHeaderParams.Accept = 'application/json';
461
+ }
462
+ else {
463
+ localVarHeaderParams.Accept = produces.join(',');
464
+ }
465
+ let localVarFormParams;
466
+ // verify required parameter 'projectId' is not null or undefined
467
+ if (projectId === null || projectId === undefined) {
468
+ throw new Error('Required parameter projectId was null or undefined when calling getWebhookDestination.');
469
+ }
470
+ // verify required parameter 'webhookId' is not null or undefined
471
+ if (webhookId === null || webhookId === undefined) {
472
+ throw new Error('Required parameter webhookId was null or undefined when calling getWebhookDestination.');
473
+ }
474
+ localVarHeaderParams = {
475
+ ...localVarHeaderParams,
476
+ ...options.headers,
477
+ ...this.opts.extraHeaders,
478
+ };
479
+ const queryString = Object.entries(queryParameters)
480
+ .filter(([, value]) => value !== undefined)
481
+ .map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
482
+ .join('&');
483
+ let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
484
+ let localVarRequestOptions = {
485
+ method: 'GET',
486
+ headers: { ...localVarHeaderParams },
487
+ };
488
+ let requestOptions = localVarRequestOptions;
489
+ let url = localVarUrl;
490
+ const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
491
+ requestOptions = auth_ApiKeyAuthentication.requestOptions;
492
+ url = auth_ApiKeyAuthentication.url;
493
+ const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
494
+ requestOptions = auth_JWTAuthentication.requestOptions;
495
+ url = auth_JWTAuthentication.url;
496
+ const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
497
+ requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
498
+ url = auth_JWTHttpHeaderAuthentication.url;
499
+ const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
500
+ requestOptions = auth_OAuth2.requestOptions;
501
+ url = auth_OAuth2.url;
502
+ const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
503
+ requestOptions = authDefault.requestOptions;
504
+ url = authDefault.url;
505
+ (0, models_1.applyFormParams)(requestOptions, localVarFormParams);
506
+ const response = await fetch(url, requestOptions);
507
+ return this.handleResponse(response, 'GetWebhookDestinationResponse');
508
+ }
509
+ /**
510
+ * List all monitoring event subscriptions for this project.
511
+ * @summary List event subscriptions
512
+ * @param projectId Project ID
513
+ */
514
+ async listEventSubscriptions(projectId, options = { headers: {} }) {
515
+ const localVarPath = this.basePath + '/api/{projectId}/monitoring/event-subscriptions'
516
+ .replace('{' + 'projectId' + '}', encodeURIComponent(String(projectId)));
517
+ let queryParameters = {};
518
+ let localVarHeaderParams = {
519
+ 'User-Agent': 'edgeimpulse-api nodejs',
520
+ 'Content-Type': 'application/json',
521
+ ...this.defaultHeaders,
522
+ };
523
+ const produces = ['application/json'];
524
+ // give precedence to 'application/json'
525
+ if (produces.indexOf('application/json') >= 0) {
526
+ localVarHeaderParams.Accept = 'application/json';
527
+ }
528
+ else {
529
+ localVarHeaderParams.Accept = produces.join(',');
530
+ }
531
+ let localVarFormParams;
532
+ // verify required parameter 'projectId' is not null or undefined
533
+ if (projectId === null || projectId === undefined) {
534
+ throw new Error('Required parameter projectId was null or undefined when calling listEventSubscriptions.');
535
+ }
536
+ localVarHeaderParams = {
537
+ ...localVarHeaderParams,
538
+ ...options.headers,
539
+ ...this.opts.extraHeaders,
540
+ };
541
+ const queryString = Object.entries(queryParameters)
542
+ .filter(([, value]) => value !== undefined)
543
+ .map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
544
+ .join('&');
545
+ let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
546
+ let localVarRequestOptions = {
547
+ method: 'GET',
548
+ headers: { ...localVarHeaderParams },
549
+ };
550
+ let requestOptions = localVarRequestOptions;
551
+ let url = localVarUrl;
552
+ const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
553
+ requestOptions = auth_ApiKeyAuthentication.requestOptions;
554
+ url = auth_ApiKeyAuthentication.url;
555
+ const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
556
+ requestOptions = auth_JWTAuthentication.requestOptions;
557
+ url = auth_JWTAuthentication.url;
558
+ const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
559
+ requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
560
+ url = auth_JWTHttpHeaderAuthentication.url;
561
+ const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
562
+ requestOptions = auth_OAuth2.requestOptions;
563
+ url = auth_OAuth2.url;
564
+ const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
565
+ requestOptions = authDefault.requestOptions;
566
+ url = authDefault.url;
567
+ (0, models_1.applyFormParams)(requestOptions, localVarFormParams);
568
+ const response = await fetch(url, requestOptions);
569
+ return this.handleResponse(response, 'ListEventSubscriptionsResponse');
570
+ }
571
+ /**
572
+ * List recent monitoring events generated for this project.
573
+ * @summary List recent monitoring events
574
+ * @param projectId Project ID
575
+ * @param limit Number of recent events to fetch. Maximum is 100. Defaults to 20.
576
+ */
577
+ async listMonitoringEvents(projectId, queryParams, options = { headers: {} }) {
578
+ const localVarPath = this.basePath + '/api/{projectId}/monitoring/events'
579
+ .replace('{' + 'projectId' + '}', encodeURIComponent(String(projectId)));
580
+ let queryParameters = {};
581
+ let localVarHeaderParams = {
582
+ 'User-Agent': 'edgeimpulse-api nodejs',
583
+ 'Content-Type': 'application/json',
584
+ ...this.defaultHeaders,
585
+ };
586
+ const produces = ['application/json'];
587
+ // give precedence to 'application/json'
588
+ if (produces.indexOf('application/json') >= 0) {
589
+ localVarHeaderParams.Accept = 'application/json';
590
+ }
591
+ else {
592
+ localVarHeaderParams.Accept = produces.join(',');
593
+ }
594
+ let localVarFormParams;
595
+ // verify required parameter 'projectId' is not null or undefined
596
+ if (projectId === null || projectId === undefined) {
597
+ throw new Error('Required parameter projectId was null or undefined when calling listMonitoringEvents.');
598
+ }
599
+ if (typeof (queryParams === null || queryParams === void 0 ? void 0 : queryParams.limit) !== 'undefined' && (queryParams === null || queryParams === void 0 ? void 0 : queryParams.limit) !== null) {
600
+ queryParameters['limit'] = queryParams.limit;
601
+ }
602
+ localVarHeaderParams = {
603
+ ...localVarHeaderParams,
604
+ ...options.headers,
605
+ ...this.opts.extraHeaders,
606
+ };
607
+ const queryString = Object.entries(queryParameters)
608
+ .filter(([, value]) => value !== undefined)
609
+ .map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
610
+ .join('&');
611
+ let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
612
+ let localVarRequestOptions = {
613
+ method: 'GET',
614
+ headers: { ...localVarHeaderParams },
615
+ };
616
+ let requestOptions = localVarRequestOptions;
617
+ let url = localVarUrl;
618
+ const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
619
+ requestOptions = auth_ApiKeyAuthentication.requestOptions;
620
+ url = auth_ApiKeyAuthentication.url;
621
+ const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
622
+ requestOptions = auth_JWTAuthentication.requestOptions;
623
+ url = auth_JWTAuthentication.url;
624
+ const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
625
+ requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
626
+ url = auth_JWTHttpHeaderAuthentication.url;
627
+ const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
628
+ requestOptions = auth_OAuth2.requestOptions;
629
+ url = auth_OAuth2.url;
630
+ const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
631
+ requestOptions = authDefault.requestOptions;
632
+ url = authDefault.url;
633
+ (0, models_1.applyFormParams)(requestOptions, localVarFormParams);
634
+ const response = await fetch(url, requestOptions);
635
+ return this.handleResponse(response, 'ListMonitoringEventsResponse');
636
+ }
637
+ /**
638
+ * List all webhook destinations for this project.
639
+ * @summary List webhook destinations
640
+ * @param projectId Project ID
641
+ */
642
+ async listWebhookDestinations(projectId, options = { headers: {} }) {
643
+ const localVarPath = this.basePath + '/api/{projectId}/monitoring/webhooks'
644
+ .replace('{' + 'projectId' + '}', encodeURIComponent(String(projectId)));
645
+ let queryParameters = {};
646
+ let localVarHeaderParams = {
647
+ 'User-Agent': 'edgeimpulse-api nodejs',
648
+ 'Content-Type': 'application/json',
649
+ ...this.defaultHeaders,
650
+ };
651
+ const produces = ['application/json'];
652
+ // give precedence to 'application/json'
653
+ if (produces.indexOf('application/json') >= 0) {
654
+ localVarHeaderParams.Accept = 'application/json';
655
+ }
656
+ else {
657
+ localVarHeaderParams.Accept = produces.join(',');
658
+ }
659
+ let localVarFormParams;
660
+ // verify required parameter 'projectId' is not null or undefined
661
+ if (projectId === null || projectId === undefined) {
662
+ throw new Error('Required parameter projectId was null or undefined when calling listWebhookDestinations.');
663
+ }
664
+ localVarHeaderParams = {
665
+ ...localVarHeaderParams,
666
+ ...options.headers,
667
+ ...this.opts.extraHeaders,
668
+ };
669
+ const queryString = Object.entries(queryParameters)
670
+ .filter(([, value]) => value !== undefined)
671
+ .map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
672
+ .join('&');
673
+ let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
674
+ let localVarRequestOptions = {
675
+ method: 'GET',
676
+ headers: { ...localVarHeaderParams },
677
+ };
678
+ let requestOptions = localVarRequestOptions;
679
+ let url = localVarUrl;
680
+ const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
681
+ requestOptions = auth_ApiKeyAuthentication.requestOptions;
682
+ url = auth_ApiKeyAuthentication.url;
683
+ const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
684
+ requestOptions = auth_JWTAuthentication.requestOptions;
685
+ url = auth_JWTAuthentication.url;
686
+ const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
687
+ requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
688
+ url = auth_JWTHttpHeaderAuthentication.url;
689
+ const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
690
+ requestOptions = auth_OAuth2.requestOptions;
691
+ url = auth_OAuth2.url;
692
+ const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
693
+ requestOptions = authDefault.requestOptions;
694
+ url = authDefault.url;
695
+ (0, models_1.applyFormParams)(requestOptions, localVarFormParams);
696
+ const response = await fetch(url, requestOptions);
697
+ return this.handleResponse(response, 'ListWebhookDestinationsResponse');
698
+ }
699
+ /**
700
+ * Rotate the signing secret for a webhook destination. Note that rotating the secret does not reset consecutive_failures, and does not re-enable a disabled webhook. Use the update endpoint for that.
701
+ * @summary Rotate webhook destination secret
702
+ * @param projectId Project ID
703
+ * @param webhookId Webhook destination ID
704
+ */
705
+ async rotateWebhookDestinationSecret(projectId, webhookId, options = { headers: {} }) {
706
+ const localVarPath = this.basePath + '/api/{projectId}/monitoring/webhooks/{webhookId}/rotate-secret'
707
+ .replace('{' + 'projectId' + '}', encodeURIComponent(String(projectId)))
708
+ .replace('{' + 'webhookId' + '}', encodeURIComponent(String(webhookId)));
709
+ let queryParameters = {};
710
+ let localVarHeaderParams = {
711
+ 'User-Agent': 'edgeimpulse-api nodejs',
712
+ 'Content-Type': 'application/json',
713
+ ...this.defaultHeaders,
714
+ };
715
+ const produces = ['application/json'];
716
+ // give precedence to 'application/json'
717
+ if (produces.indexOf('application/json') >= 0) {
718
+ localVarHeaderParams.Accept = 'application/json';
719
+ }
720
+ else {
721
+ localVarHeaderParams.Accept = produces.join(',');
722
+ }
723
+ let localVarFormParams;
724
+ // verify required parameter 'projectId' is not null or undefined
725
+ if (projectId === null || projectId === undefined) {
726
+ throw new Error('Required parameter projectId was null or undefined when calling rotateWebhookDestinationSecret.');
727
+ }
728
+ // verify required parameter 'webhookId' is not null or undefined
729
+ if (webhookId === null || webhookId === undefined) {
730
+ throw new Error('Required parameter webhookId was null or undefined when calling rotateWebhookDestinationSecret.');
731
+ }
732
+ localVarHeaderParams = {
733
+ ...localVarHeaderParams,
734
+ ...options.headers,
735
+ ...this.opts.extraHeaders,
736
+ };
737
+ const queryString = Object.entries(queryParameters)
738
+ .filter(([, value]) => value !== undefined)
739
+ .map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
740
+ .join('&');
741
+ let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
742
+ let localVarRequestOptions = {
743
+ method: 'POST',
744
+ headers: { ...localVarHeaderParams },
745
+ };
746
+ let requestOptions = localVarRequestOptions;
747
+ let url = localVarUrl;
748
+ const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
749
+ requestOptions = auth_ApiKeyAuthentication.requestOptions;
750
+ url = auth_ApiKeyAuthentication.url;
751
+ const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
752
+ requestOptions = auth_JWTAuthentication.requestOptions;
753
+ url = auth_JWTAuthentication.url;
754
+ const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
755
+ requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
756
+ url = auth_JWTHttpHeaderAuthentication.url;
757
+ const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
758
+ requestOptions = auth_OAuth2.requestOptions;
759
+ url = auth_OAuth2.url;
760
+ const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
761
+ requestOptions = authDefault.requestOptions;
762
+ url = authDefault.url;
763
+ (0, models_1.applyFormParams)(requestOptions, localVarFormParams);
764
+ const response = await fetch(url, requestOptions);
765
+ return this.handleResponse(response, 'RotateWebhookDestinationSecretResponse');
766
+ }
767
+ /**
768
+ * Send a test webhook to the configured URL for this destination. This is useful for testing if the webhook is configured correctly.
769
+ * @summary Test webhook destination
770
+ * @param projectId Project ID
771
+ * @param webhookId Webhook destination ID
772
+ */
773
+ async testWebhookDestination(projectId, webhookId, options = { headers: {} }) {
774
+ const localVarPath = this.basePath + '/api/{projectId}/monitoring/webhooks/{webhookId}/test'
775
+ .replace('{' + 'projectId' + '}', encodeURIComponent(String(projectId)))
776
+ .replace('{' + 'webhookId' + '}', encodeURIComponent(String(webhookId)));
777
+ let queryParameters = {};
778
+ let localVarHeaderParams = {
779
+ 'User-Agent': 'edgeimpulse-api nodejs',
780
+ 'Content-Type': 'application/json',
781
+ ...this.defaultHeaders,
782
+ };
783
+ const produces = ['application/json'];
784
+ // give precedence to 'application/json'
785
+ if (produces.indexOf('application/json') >= 0) {
786
+ localVarHeaderParams.Accept = 'application/json';
787
+ }
788
+ else {
789
+ localVarHeaderParams.Accept = produces.join(',');
790
+ }
791
+ let localVarFormParams;
792
+ // verify required parameter 'projectId' is not null or undefined
793
+ if (projectId === null || projectId === undefined) {
794
+ throw new Error('Required parameter projectId was null or undefined when calling testWebhookDestination.');
795
+ }
796
+ // verify required parameter 'webhookId' is not null or undefined
797
+ if (webhookId === null || webhookId === undefined) {
798
+ throw new Error('Required parameter webhookId was null or undefined when calling testWebhookDestination.');
799
+ }
800
+ localVarHeaderParams = {
801
+ ...localVarHeaderParams,
802
+ ...options.headers,
803
+ ...this.opts.extraHeaders,
804
+ };
805
+ const queryString = Object.entries(queryParameters)
806
+ .filter(([, value]) => value !== undefined)
807
+ .map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
808
+ .join('&');
809
+ let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
810
+ let localVarRequestOptions = {
811
+ method: 'POST',
812
+ headers: { ...localVarHeaderParams },
813
+ };
814
+ let requestOptions = localVarRequestOptions;
815
+ let url = localVarUrl;
816
+ const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
817
+ requestOptions = auth_ApiKeyAuthentication.requestOptions;
818
+ url = auth_ApiKeyAuthentication.url;
819
+ const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
820
+ requestOptions = auth_JWTAuthentication.requestOptions;
821
+ url = auth_JWTAuthentication.url;
822
+ const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
823
+ requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
824
+ url = auth_JWTHttpHeaderAuthentication.url;
825
+ const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
826
+ requestOptions = auth_OAuth2.requestOptions;
827
+ url = auth_OAuth2.url;
828
+ const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
829
+ requestOptions = authDefault.requestOptions;
830
+ url = authDefault.url;
831
+ (0, models_1.applyFormParams)(requestOptions, localVarFormParams);
832
+ const response = await fetch(url, requestOptions);
833
+ return this.handleResponse(response, 'TestWebhookDestinationResponse');
834
+ }
835
+ /**
836
+ * Update a monitoring event subscription.
837
+ * @summary Update event subscription
838
+ * @param projectId Project ID
839
+ * @param eventSubscriptionId Event subscription ID
840
+ * @param updateEventSubscriptionRequest
841
+ */
842
+ async updateEventSubscription(projectId, eventSubscriptionId, updateEventSubscriptionRequest, options = { headers: {} }) {
843
+ const localVarPath = this.basePath + '/api/{projectId}/monitoring/event-subscriptions/{eventSubscriptionId}'
844
+ .replace('{' + 'projectId' + '}', encodeURIComponent(String(projectId)))
845
+ .replace('{' + 'eventSubscriptionId' + '}', encodeURIComponent(String(eventSubscriptionId)));
846
+ let queryParameters = {};
847
+ let localVarHeaderParams = {
848
+ 'User-Agent': 'edgeimpulse-api nodejs',
849
+ 'Content-Type': 'application/json',
850
+ ...this.defaultHeaders,
851
+ };
852
+ const produces = ['application/json'];
853
+ // give precedence to 'application/json'
854
+ if (produces.indexOf('application/json') >= 0) {
855
+ localVarHeaderParams.Accept = 'application/json';
856
+ }
857
+ else {
858
+ localVarHeaderParams.Accept = produces.join(',');
859
+ }
860
+ let localVarFormParams;
861
+ // verify required parameter 'projectId' is not null or undefined
862
+ if (projectId === null || projectId === undefined) {
863
+ throw new Error('Required parameter projectId was null or undefined when calling updateEventSubscription.');
864
+ }
865
+ // verify required parameter 'eventSubscriptionId' is not null or undefined
866
+ if (eventSubscriptionId === null || eventSubscriptionId === undefined) {
867
+ throw new Error('Required parameter eventSubscriptionId was null or undefined when calling updateEventSubscription.');
868
+ }
869
+ // verify required parameter 'updateEventSubscriptionRequest' is not null or undefined
870
+ if (updateEventSubscriptionRequest === null || updateEventSubscriptionRequest === undefined) {
871
+ throw new Error('Required parameter updateEventSubscriptionRequest was null or undefined when calling updateEventSubscription.');
872
+ }
873
+ localVarHeaderParams = {
874
+ ...localVarHeaderParams,
875
+ ...options.headers,
876
+ ...this.opts.extraHeaders,
877
+ };
878
+ const queryString = Object.entries(queryParameters)
879
+ .filter(([, value]) => value !== undefined)
880
+ .map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
881
+ .join('&');
882
+ let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
883
+ let localVarRequestOptions = {
884
+ method: 'PATCH',
885
+ headers: { ...localVarHeaderParams },
886
+ };
887
+ localVarRequestOptions.body = JSON.stringify(updateEventSubscriptionRequest);
888
+ let requestOptions = localVarRequestOptions;
889
+ let url = localVarUrl;
890
+ const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
891
+ requestOptions = auth_ApiKeyAuthentication.requestOptions;
892
+ url = auth_ApiKeyAuthentication.url;
893
+ const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
894
+ requestOptions = auth_JWTAuthentication.requestOptions;
895
+ url = auth_JWTAuthentication.url;
896
+ const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
897
+ requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
898
+ url = auth_JWTHttpHeaderAuthentication.url;
899
+ const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
900
+ requestOptions = auth_OAuth2.requestOptions;
901
+ url = auth_OAuth2.url;
902
+ const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
903
+ requestOptions = authDefault.requestOptions;
904
+ url = authDefault.url;
905
+ (0, models_1.applyFormParams)(requestOptions, localVarFormParams);
906
+ const response = await fetch(url, requestOptions);
907
+ return this.handleResponse(response, 'GenericApiResponse');
908
+ }
909
+ /**
910
+ * Update the details of a webhook destination. Note that re-enabling a previously auto-disabled webhook resets consecutive_failures to 0. Note that only the rotate-secret endpoint can update the signing secret.
911
+ * @summary Update webhook destination
912
+ * @param projectId Project ID
913
+ * @param webhookId Webhook destination ID
914
+ * @param updateWebhookDestinationRequest
915
+ */
916
+ async updateWebhookDestination(projectId, webhookId, updateWebhookDestinationRequest, options = { headers: {} }) {
917
+ const localVarPath = this.basePath + '/api/{projectId}/monitoring/webhooks/{webhookId}'
918
+ .replace('{' + 'projectId' + '}', encodeURIComponent(String(projectId)))
919
+ .replace('{' + 'webhookId' + '}', encodeURIComponent(String(webhookId)));
920
+ let queryParameters = {};
921
+ let localVarHeaderParams = {
922
+ 'User-Agent': 'edgeimpulse-api nodejs',
923
+ 'Content-Type': 'application/json',
924
+ ...this.defaultHeaders,
925
+ };
926
+ const produces = ['application/json'];
927
+ // give precedence to 'application/json'
928
+ if (produces.indexOf('application/json') >= 0) {
929
+ localVarHeaderParams.Accept = 'application/json';
930
+ }
931
+ else {
932
+ localVarHeaderParams.Accept = produces.join(',');
933
+ }
934
+ let localVarFormParams;
935
+ // verify required parameter 'projectId' is not null or undefined
936
+ if (projectId === null || projectId === undefined) {
937
+ throw new Error('Required parameter projectId was null or undefined when calling updateWebhookDestination.');
938
+ }
939
+ // verify required parameter 'webhookId' is not null or undefined
940
+ if (webhookId === null || webhookId === undefined) {
941
+ throw new Error('Required parameter webhookId was null or undefined when calling updateWebhookDestination.');
942
+ }
943
+ // verify required parameter 'updateWebhookDestinationRequest' is not null or undefined
944
+ if (updateWebhookDestinationRequest === null || updateWebhookDestinationRequest === undefined) {
945
+ throw new Error('Required parameter updateWebhookDestinationRequest was null or undefined when calling updateWebhookDestination.');
946
+ }
947
+ localVarHeaderParams = {
948
+ ...localVarHeaderParams,
949
+ ...options.headers,
950
+ ...this.opts.extraHeaders,
951
+ };
952
+ const queryString = Object.entries(queryParameters)
953
+ .filter(([, value]) => value !== undefined)
954
+ .map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
955
+ .join('&');
956
+ let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
957
+ let localVarRequestOptions = {
958
+ method: 'PATCH',
959
+ headers: { ...localVarHeaderParams },
960
+ };
961
+ localVarRequestOptions.body = JSON.stringify(updateWebhookDestinationRequest);
962
+ let requestOptions = localVarRequestOptions;
963
+ let url = localVarUrl;
964
+ const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
965
+ requestOptions = auth_ApiKeyAuthentication.requestOptions;
966
+ url = auth_ApiKeyAuthentication.url;
967
+ const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
968
+ requestOptions = auth_JWTAuthentication.requestOptions;
969
+ url = auth_JWTAuthentication.url;
970
+ const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
971
+ requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
972
+ url = auth_JWTHttpHeaderAuthentication.url;
973
+ const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
974
+ requestOptions = auth_OAuth2.requestOptions;
975
+ url = auth_OAuth2.url;
976
+ const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
977
+ requestOptions = authDefault.requestOptions;
978
+ url = authDefault.url;
979
+ (0, models_1.applyFormParams)(requestOptions, localVarFormParams);
980
+ const response = await fetch(url, requestOptions);
981
+ return this.handleResponse(response, 'GenericApiResponse');
982
+ }
983
+ }
984
+ exports.MonitoringApi = MonitoringApi;
985
+ //# sourceMappingURL=monitoringApi.js.map