edge-impulse-api 1.95.11 → 1.95.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.
@@ -21,6 +21,7 @@ import { GetDataExplorerFeaturesResponse } from '../model/getDataExplorerFeature
21
21
  import { GetPretrainedModelResponse } from '../model/getPretrainedModelResponse';
22
22
  import { KerasModelMetadataResponse } from '../model/kerasModelMetadataResponse';
23
23
  import { KerasResponse } from '../model/kerasResponse';
24
+ import { ListLearnBlockFilesResponse } from '../model/listLearnBlockFilesResponse';
24
25
  import { SavePretrainedModelRequest } from '../model/savePretrainedModelRequest';
25
26
  import { SetAnomalyParameterRequest } from '../model/setAnomalyParameterRequest';
26
27
  import { SetKerasParameterRequest } from '../model/setKerasParameterRequest';
@@ -59,6 +60,9 @@ type getPretrainedModelInfoQueryParams = {
59
60
  type profilePretrainedModelQueryParams = {
60
61
  impulseId?: number;
61
62
  };
63
+ type readLearnBlockCustomDataFileQueryParams = {
64
+ path: string;
65
+ };
62
66
  type savePretrainedModelParametersQueryParams = {
63
67
  impulseId?: number;
64
68
  };
@@ -353,6 +357,20 @@ export declare class LearnApi {
353
357
  [name: string]: string;
354
358
  }) => void;
355
359
  }): Promise<VlmConfigResponse>;
360
+ /**
361
+ * List all custom files for the learn block as they exist on the file system. You can write extra files to /home/custom_data in your custom learn block (or in expert mode); then pick them up here. This yields all files across all subfolders.
362
+ * @summary List learn block custom data files
363
+ * @param projectId Project ID
364
+ * @param learnId Learn Block ID, use the impulse functions to retrieve the ID
365
+ */
366
+ listLearnBlockCustomDataFiles(projectId: number, learnId: number, options?: {
367
+ headers: {
368
+ [name: string]: string;
369
+ };
370
+ responseHeadersCallback?: (headers: {
371
+ [name: string]: string;
372
+ }) => void;
373
+ }): Promise<ListLearnBlockFilesResponse>;
356
374
  /**
357
375
  * Returns the latency, RAM and ROM used for the pretrained model - upload first via `uploadPretrainedModel`. This is using the project\'s selected latency device. Updates are streamed over the websocket API (or can be retrieved through the /stdout endpoint). Use getProfileTfliteJobResult to get the results when the job is completed.
358
376
  * @summary Profile pretrained model
@@ -367,6 +385,21 @@ export declare class LearnApi {
367
385
  [name: string]: string;
368
386
  }) => void;
369
387
  }): Promise<StartJobResponse>;
388
+ /**
389
+ * Read a file from the learn block as it exists on the file system. You can write extra files to /home/custom_data in your custom learn block (or in expert mode); then pick them up here. Use \"listLearnBlockCustomDataFiles\" to list all available files.
390
+ * @summary Read learn block custom data file
391
+ * @param projectId Project ID
392
+ * @param learnId Learn Block ID, use the impulse functions to retrieve the ID
393
+ * @param path CDN Path
394
+ */
395
+ readLearnBlockCustomDataFile(projectId: number, learnId: number, queryParams: readLearnBlockCustomDataFileQueryParams, options?: {
396
+ headers: {
397
+ [name: string]: string;
398
+ };
399
+ responseHeadersCallback?: (headers: {
400
+ [name: string]: string;
401
+ }) => void;
402
+ }): Promise<Buffer>;
370
403
  /**
371
404
  * Save input / model configuration for a pretrained model. This overrides the current impulse. If you want to deploy a pretrained model from the API, see `startDeployPretrainedModelJob`.
372
405
  * @summary Save parameters for pretrained model
@@ -1439,6 +1439,82 @@ class LearnApi {
1439
1439
  }
1440
1440
  return resp;
1441
1441
  }
1442
+ /**
1443
+ * List all custom files for the learn block as they exist on the file system. You can write extra files to /home/custom_data in your custom learn block (or in expert mode); then pick them up here. This yields all files across all subfolders.
1444
+ * @summary List learn block custom data files
1445
+ * @param projectId Project ID
1446
+ * @param learnId Learn Block ID, use the impulse functions to retrieve the ID
1447
+ */
1448
+ async listLearnBlockCustomDataFiles(projectId, learnId, options = { headers: {} }) {
1449
+ const localVarPath = this.basePath + '/api/{projectId}/learn-data/{learnId}/custom-data/list'
1450
+ .replace('{' + 'projectId' + '}', encodeURIComponent(String(projectId)))
1451
+ .replace('{' + 'learnId' + '}', encodeURIComponent(String(learnId)));
1452
+ let queryParameters = {};
1453
+ let localVarHeaderParams = {
1454
+ 'User-Agent': 'edgeimpulse-api nodejs',
1455
+ 'Content-Type': 'application/json',
1456
+ ...this.defaultHeaders,
1457
+ };
1458
+ const produces = ['application/json'];
1459
+ // give precedence to 'application/json'
1460
+ if (produces.indexOf('application/json') >= 0) {
1461
+ localVarHeaderParams.Accept = 'application/json';
1462
+ }
1463
+ else {
1464
+ localVarHeaderParams.Accept = produces.join(',');
1465
+ }
1466
+ let localVarFormParams;
1467
+ // verify required parameter 'projectId' is not null or undefined
1468
+ if (projectId === null || projectId === undefined) {
1469
+ throw new Error('Required parameter projectId was null or undefined when calling listLearnBlockCustomDataFiles.');
1470
+ }
1471
+ // verify required parameter 'learnId' is not null or undefined
1472
+ if (learnId === null || learnId === undefined) {
1473
+ throw new Error('Required parameter learnId was null or undefined when calling listLearnBlockCustomDataFiles.');
1474
+ }
1475
+ localVarHeaderParams = {
1476
+ ...localVarHeaderParams,
1477
+ ...options.headers,
1478
+ ...this.opts.extraHeaders,
1479
+ };
1480
+ const queryString = Object.entries(queryParameters)
1481
+ .filter(([, value]) => value !== undefined)
1482
+ .map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
1483
+ .join('&');
1484
+ let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
1485
+ let localVarRequestOptions = {
1486
+ method: 'GET',
1487
+ headers: { ...localVarHeaderParams },
1488
+ };
1489
+ let requestOptions = localVarRequestOptions;
1490
+ let url = localVarUrl;
1491
+ const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
1492
+ requestOptions = auth_ApiKeyAuthentication.requestOptions;
1493
+ url = auth_ApiKeyAuthentication.url;
1494
+ const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
1495
+ requestOptions = auth_JWTAuthentication.requestOptions;
1496
+ url = auth_JWTAuthentication.url;
1497
+ const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
1498
+ requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
1499
+ url = auth_JWTHttpHeaderAuthentication.url;
1500
+ const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
1501
+ requestOptions = auth_OAuth2.requestOptions;
1502
+ url = auth_OAuth2.url;
1503
+ const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
1504
+ requestOptions = authDefault.requestOptions;
1505
+ url = authDefault.url;
1506
+ (0, models_1.applyFormParams)(requestOptions, localVarFormParams);
1507
+ const response = await fetch(url, requestOptions);
1508
+ const resp = this.handleResponse(response, 'ListLearnBlockFilesResponse');
1509
+ if (options === null || options === void 0 ? void 0 : options.responseHeadersCallback) {
1510
+ const headerCb = options.responseHeadersCallback;
1511
+ // on next tick, so we have time to handle the response
1512
+ setTimeout(() => {
1513
+ headerCb(Object.fromEntries(response.headers.entries()));
1514
+ }, 0);
1515
+ }
1516
+ return resp;
1517
+ }
1442
1518
  /**
1443
1519
  * Returns the latency, RAM and ROM used for the pretrained model - upload first via `uploadPretrainedModel`. This is using the project\'s selected latency device. Updates are streamed over the websocket API (or can be retrieved through the /stdout endpoint). Use getProfileTfliteJobResult to get the results when the job is completed.
1444
1520
  * @summary Profile pretrained model
@@ -1513,6 +1589,90 @@ class LearnApi {
1513
1589
  }
1514
1590
  return resp;
1515
1591
  }
1592
+ /**
1593
+ * Read a file from the learn block as it exists on the file system. You can write extra files to /home/custom_data in your custom learn block (or in expert mode); then pick them up here. Use \"listLearnBlockCustomDataFiles\" to list all available files.
1594
+ * @summary Read learn block custom data file
1595
+ * @param projectId Project ID
1596
+ * @param learnId Learn Block ID, use the impulse functions to retrieve the ID
1597
+ * @param path CDN Path
1598
+ */
1599
+ async readLearnBlockCustomDataFile(projectId, learnId, queryParams, options = { headers: {} }) {
1600
+ const localVarPath = this.basePath + '/api/{projectId}/learn-data/{learnId}/custom-data/read'
1601
+ .replace('{' + 'projectId' + '}', encodeURIComponent(String(projectId)))
1602
+ .replace('{' + 'learnId' + '}', encodeURIComponent(String(learnId)));
1603
+ let queryParameters = {};
1604
+ let localVarHeaderParams = {
1605
+ 'User-Agent': 'edgeimpulse-api nodejs',
1606
+ 'Content-Type': 'application/json',
1607
+ ...this.defaultHeaders,
1608
+ };
1609
+ const produces = ['application/octet-stream'];
1610
+ // give precedence to 'application/json'
1611
+ if (produces.indexOf('application/json') >= 0) {
1612
+ localVarHeaderParams.Accept = 'application/json';
1613
+ }
1614
+ else {
1615
+ localVarHeaderParams.Accept = produces.join(',');
1616
+ }
1617
+ let localVarFormParams;
1618
+ // verify required parameter 'projectId' is not null or undefined
1619
+ if (projectId === null || projectId === undefined) {
1620
+ throw new Error('Required parameter projectId was null or undefined when calling readLearnBlockCustomDataFile.');
1621
+ }
1622
+ // verify required parameter 'learnId' is not null or undefined
1623
+ if (learnId === null || learnId === undefined) {
1624
+ throw new Error('Required parameter learnId was null or undefined when calling readLearnBlockCustomDataFile.');
1625
+ }
1626
+ // verify required parameter 'path' is not null or undefined
1627
+ if (queryParams.path === null || queryParams.path === undefined) {
1628
+ throw new Error('Required parameter queryParams.path was null or undefined when calling readLearnBlockCustomDataFile.');
1629
+ }
1630
+ if (typeof (queryParams === null || queryParams === void 0 ? void 0 : queryParams.path) !== 'undefined' && (queryParams === null || queryParams === void 0 ? void 0 : queryParams.path) !== null) {
1631
+ queryParameters['path'] = queryParams.path;
1632
+ }
1633
+ localVarHeaderParams = {
1634
+ ...localVarHeaderParams,
1635
+ ...options.headers,
1636
+ ...this.opts.extraHeaders,
1637
+ };
1638
+ const queryString = Object.entries(queryParameters)
1639
+ .filter(([, value]) => value !== undefined)
1640
+ .map(([key, value]) => `${key}=${encodeURIComponent(String(value))}`)
1641
+ .join('&');
1642
+ let localVarUrl = localVarPath + (queryString ? `?${queryString}` : '');
1643
+ let localVarRequestOptions = {
1644
+ method: 'GET',
1645
+ headers: { ...localVarHeaderParams },
1646
+ };
1647
+ let requestOptions = localVarRequestOptions;
1648
+ let url = localVarUrl;
1649
+ const auth_ApiKeyAuthentication = await this.authentications.ApiKeyAuthentication.applyToRequest(requestOptions, url);
1650
+ requestOptions = auth_ApiKeyAuthentication.requestOptions;
1651
+ url = auth_ApiKeyAuthentication.url;
1652
+ const auth_JWTAuthentication = await this.authentications.JWTAuthentication.applyToRequest(requestOptions, url);
1653
+ requestOptions = auth_JWTAuthentication.requestOptions;
1654
+ url = auth_JWTAuthentication.url;
1655
+ const auth_JWTHttpHeaderAuthentication = await this.authentications.JWTHttpHeaderAuthentication.applyToRequest(requestOptions, url);
1656
+ requestOptions = auth_JWTHttpHeaderAuthentication.requestOptions;
1657
+ url = auth_JWTHttpHeaderAuthentication.url;
1658
+ const auth_OAuth2 = await this.authentications.OAuth2.applyToRequest(requestOptions, url);
1659
+ requestOptions = auth_OAuth2.requestOptions;
1660
+ url = auth_OAuth2.url;
1661
+ const authDefault = await this.authentications.default.applyToRequest(requestOptions, url);
1662
+ requestOptions = authDefault.requestOptions;
1663
+ url = authDefault.url;
1664
+ (0, models_1.applyFormParams)(requestOptions, localVarFormParams);
1665
+ const response = await fetch(url, requestOptions);
1666
+ const resp = this.handleResponse(response, 'Buffer');
1667
+ if (options === null || options === void 0 ? void 0 : options.responseHeadersCallback) {
1668
+ const headerCb = options.responseHeadersCallback;
1669
+ // on next tick, so we have time to handle the response
1670
+ setTimeout(() => {
1671
+ headerCb(Object.fromEntries(response.headers.entries()));
1672
+ }, 0);
1673
+ }
1674
+ return resp;
1675
+ }
1516
1676
  /**
1517
1677
  * Save input / model configuration for a pretrained model. This overrides the current impulse. If you want to deploy a pretrained model from the API, see `startDeployPretrainedModelJob`.
1518
1678
  * @summary Save parameters for pretrained model