edge-impulse-api 1.93.0 → 1.93.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.
@@ -41,6 +41,7 @@ import { AdminGetUsersResponse } from '../model/adminGetUsersResponse';
41
41
  import { AdminListProjectsResponse } from '../model/adminListProjectsResponse';
42
42
  import { AdminOrganizationInfoResponse } from '../model/adminOrganizationInfoResponse';
43
43
  import { AdminProjectInfoResponse } from '../model/adminProjectInfoResponse';
44
+ import { AdminProjectKillSwitchResponse } from '../model/adminProjectKillSwitchResponse';
44
45
  import { AdminRotateOauthClientSecretResponse } from '../model/adminRotateOauthClientSecretResponse';
45
46
  import { AdminStartEnterpriseTrialRequest } from '../model/adminStartEnterpriseTrialRequest';
46
47
  import { AdminToggleDataMigrationRequest } from '../model/adminToggleDataMigrationRequest';
@@ -218,6 +219,9 @@ type adminListTrashbinUserS3FilesQueryParams = {
218
219
  sourceBucket: 'ingestion' | 'cdn' | 'user-data';
219
220
  continuationToken?: string;
220
221
  };
222
+ type adminProjectKillSwitchQueryParams = {
223
+ skipRevokeApiKeys?: boolean;
224
+ };
221
225
  export type adminUploadOauthClientLogoFormParams = {
222
226
  image: RequestFile;
223
227
  };
@@ -1118,6 +1122,17 @@ export declare class AdminApi {
1118
1122
  [name: string]: string;
1119
1123
  };
1120
1124
  }): Promise<StartJobResponse>;
1125
+ /**
1126
+ * Admin-only API to cancel all active jobs for a project and revoke all project API keys, useful for projects with excessive usage or malicious activity.
1127
+ * @summary Trigger project kill switch
1128
+ * @param projectId Project ID
1129
+ * @param skipRevokeApiKeys Set to true to avoid revoking project API keys.
1130
+ */
1131
+ adminProjectKillSwitch(projectId: number, queryParams?: adminProjectKillSwitchQueryParams, options?: {
1132
+ headers: {
1133
+ [name: string]: string;
1134
+ };
1135
+ }): Promise<AdminProjectKillSwitchResponse>;
1121
1136
  /**
1122
1137
  * Admin-only API to remove a user from an organization.
1123
1138
  * @summary Remove user from an organization
@@ -6278,6 +6278,83 @@ class AdminApi {
6278
6278
  const response = await fetch(url, requestOptions);
6279
6279
  return this.handleResponse(response, 'StartJobResponse');
6280
6280
  }
6281
+ /**
6282
+ * Admin-only API to cancel all active jobs for a project and revoke all project API keys, useful for projects with excessive usage or malicious activity.
6283
+ * @summary Trigger project kill switch
6284
+ * @param projectId Project ID
6285
+ * @param skipRevokeApiKeys Set to true to avoid revoking project API keys.
6286
+ */
6287
+ async adminProjectKillSwitch(projectId, queryParams, options = { headers: {} }) {
6288
+ const localVarPath = this.basePath + '/api/admin/projects/{projectId}/kill-switch'
6289
+ .replace('{' + 'projectId' + '}', encodeURIComponent(String(projectId)));
6290
+ let localVarQueryParameters = {};
6291
+ let localVarHeaderParams = {
6292
+ 'User-Agent': 'edgeimpulse-api nodejs',
6293
+ 'Content-Type': 'application/json',
6294
+ ...this.defaultHeaders,
6295
+ };
6296
+ const produces = ['application/json'];
6297
+ // give precedence to 'application/json'
6298
+ if (produces.indexOf('application/json') >= 0) {
6299
+ localVarHeaderParams.Accept = 'application/json';
6300
+ }
6301
+ else {
6302
+ localVarHeaderParams.Accept = produces.join(',');
6303
+ }
6304
+ let localVarFormParams;
6305
+ // verify required parameter 'projectId' is not null or undefined
6306
+ if (projectId === null || projectId === undefined) {
6307
+ throw new Error('Required parameter projectId was null or undefined when calling adminProjectKillSwitch.');
6308
+ }
6309
+ if ((queryParams === null || queryParams === void 0 ? void 0 : queryParams.skipRevokeApiKeys) !== undefined) {
6310
+ localVarQueryParameters['skipRevokeApiKeys'] = models_1.ObjectSerializer.serialize(queryParams.skipRevokeApiKeys, "boolean");
6311
+ }
6312
+ localVarHeaderParams = {
6313
+ ...localVarHeaderParams,
6314
+ ...options.headers,
6315
+ ...this.opts.extraHeaders,
6316
+ };
6317
+ const queryString = Object.entries(localVarQueryParameters)
6318
+ .filter(([, value]) => value !== undefined)
6319
+ .map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
6320
+ .join('&');
6321
+ let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
6322
+ let localVarRequestOptions = {
6323
+ method: 'POST',
6324
+ headers: { ...localVarHeaderParams },
6325
+ };
6326
+ let requestOptions = localVarRequestOptions;
6327
+ let url = localVarUrl;
6328
+ const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
6329
+ requestOptions = auth_ApiKeyAuthentication.requestOptions;
6330
+ url = auth_ApiKeyAuthentication.url;
6331
+ const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
6332
+ requestOptions = auth_JWTAuthentication.requestOptions;
6333
+ url = auth_JWTAuthentication.url;
6334
+ const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
6335
+ requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
6336
+ url = auth_JWTHttpHeaderAuthentication.url;
6337
+ const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
6338
+ requestOptions = auth_OAuth2.requestOptions;
6339
+ url = auth_OAuth2.url;
6340
+ const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
6341
+ requestOptions = authDefault.requestOptions;
6342
+ url = authDefault.url;
6343
+ if (localVarFormParams) {
6344
+ delete requestOptions.headers['Content-Type'];
6345
+ if (localVarFormParams instanceof FormData) {
6346
+ // FormData: fetch will handle Content-Type automatically.
6347
+ requestOptions.body = localVarFormParams;
6348
+ }
6349
+ else if (Object.keys(localVarFormParams).length > 0) {
6350
+ // URL-encoded form
6351
+ requestOptions.body = new URLSearchParams(localVarFormParams).toString();
6352
+ requestOptions.headers['Content-Type'] = 'application/x-www-form-urlencoded';
6353
+ }
6354
+ }
6355
+ const response = await fetch(url, requestOptions);
6356
+ return this.handleResponse(response, 'AdminProjectKillSwitchResponse');
6357
+ }
6281
6358
  /**
6282
6359
  * Admin-only API to remove a user from an organization.
6283
6360
  * @summary Remove user from an organization