@edgeiq/edgeiq-api-js 1.3.18 → 1.3.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/gatewayCommands/index.d.ts +2 -1
- package/dist/gatewayCommands/index.js +25 -0
- package/dist/gatewayCommands/models.d.ts +27 -0
- package/package.json +1 -1
- package/dist/__tests__/testConstants.d.ts +0 -7
- package/dist/__tests__/testConstants.js +0 -14
- package/dist/example/index.d.ts +0 -1
- package/dist/example/index.js +0 -5
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { BaseModelInterface } from '../core/ModelClass';
|
|
2
2
|
import { BulkActionResponse } from '../models';
|
|
3
|
-
import { GatewayCommand, GatewayCommandInput, GatewayCommandsFilters, PaginatedGatewayCommands } from './models';
|
|
3
|
+
import { GatewayCommand, GatewayCommandInput, GatewayCommandsFilters, GatewayCommandRequest, PaginatedGatewayCommands } from './models';
|
|
4
4
|
interface GatewayCommandsInterface extends BaseModelInterface<GatewayCommand, GatewayCommandInput, GatewayCommandsFilters, PaginatedGatewayCommands> {
|
|
5
5
|
bulkCreate(ids: string[], gatewayCommand: GatewayCommand): Promise<BulkActionResponse>;
|
|
6
6
|
update(gatewayCommand: GatewayCommand): Promise<GatewayCommand>;
|
|
7
7
|
deleteMultiple(ids: string[]): Promise<BulkActionResponse>;
|
|
8
|
+
ProcessGatewayCommand(deviceId: string, gatewayCommandRequest: GatewayCommandRequest): Promise<GatewayCommand>;
|
|
8
9
|
}
|
|
9
10
|
export declare const GatewayCommands: GatewayCommandsInterface;
|
|
10
11
|
export {};
|
|
@@ -257,5 +257,30 @@ exports.GatewayCommands = (function (_super) {
|
|
|
257
257
|
});
|
|
258
258
|
});
|
|
259
259
|
};
|
|
260
|
+
class_1.ProcessGatewayCommand = function (deviceId, gatewayCommandRequest) {
|
|
261
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
262
|
+
var axios, data, result, error_8;
|
|
263
|
+
return __generator(this, function (_a) {
|
|
264
|
+
switch (_a.label) {
|
|
265
|
+
case 0:
|
|
266
|
+
_a.trys.push([0, 2, , 3]);
|
|
267
|
+
this.logAction("Process gateway command: " + gatewayCommandRequest.command_type + ", on device id: " + deviceId);
|
|
268
|
+
axios = __1.EdgeIQAPI.getAxios();
|
|
269
|
+
data = JSON.stringify(gatewayCommandRequest);
|
|
270
|
+
return [4, axios.post(constants_1.Endpoints.device + "/" + deviceId + "/" + gatewayCommandRequest.command_type, data)];
|
|
271
|
+
case 1:
|
|
272
|
+
result = _a.sent();
|
|
273
|
+
return [2, result === null || result === void 0 ? void 0 : result.data];
|
|
274
|
+
case 2:
|
|
275
|
+
error_8 = _a.sent();
|
|
276
|
+
if ((0, helpers_1.isApiError)(error_8)) {
|
|
277
|
+
throw error_8;
|
|
278
|
+
}
|
|
279
|
+
throw error_8;
|
|
280
|
+
case 3: return [2];
|
|
281
|
+
}
|
|
282
|
+
});
|
|
283
|
+
});
|
|
284
|
+
};
|
|
260
285
|
return class_1;
|
|
261
286
|
}(ModelClass_1.BaseModelClass));
|
|
@@ -27,6 +27,33 @@ export interface GatewayCommandInput {
|
|
|
27
27
|
attached_device_ids: string[];
|
|
28
28
|
attached_device_unique_ids: string[];
|
|
29
29
|
}
|
|
30
|
+
export interface GatewayCommandRequest {
|
|
31
|
+
command_type: GatewayCommandType;
|
|
32
|
+
schedule?: CommandSchedule;
|
|
33
|
+
timeout: number;
|
|
34
|
+
url?: string;
|
|
35
|
+
version?: string;
|
|
36
|
+
software_update_id?: string;
|
|
37
|
+
when?: string;
|
|
38
|
+
level?: string;
|
|
39
|
+
enable?: boolean;
|
|
40
|
+
card_holder?: AmagCardHolder;
|
|
41
|
+
attached_device_ids?: string[];
|
|
42
|
+
_: string[];
|
|
43
|
+
}
|
|
44
|
+
export interface AmagCardHolder {
|
|
45
|
+
first_name?: string;
|
|
46
|
+
last_name?: string;
|
|
47
|
+
card_number?: number;
|
|
48
|
+
pin?: string;
|
|
49
|
+
employee_reference?: string;
|
|
50
|
+
company_id?: number;
|
|
51
|
+
customer_code?: number;
|
|
52
|
+
access_code_id?: number;
|
|
53
|
+
active_date?: string;
|
|
54
|
+
expiry_date?: string;
|
|
55
|
+
personal_data: string[];
|
|
56
|
+
}
|
|
30
57
|
export interface GatewayCommand extends GatewayCommandInput, Base {
|
|
31
58
|
}
|
|
32
59
|
export interface GatewayCommandsFilters extends Filters {
|
package/package.json
CHANGED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TestDevice = exports.TestUser = void 0;
|
|
4
|
-
exports.TestUser = {
|
|
5
|
-
noUser: 'NO_USER_VALUE',
|
|
6
|
-
username: 'akhil.asaad+sys_admin@whiteprompt.com',
|
|
7
|
-
pass: 'PiraeBeatsVenus',
|
|
8
|
-
};
|
|
9
|
-
exports.TestDevice = {
|
|
10
|
-
device_type_id: '610aaa4abc72d700011b872d',
|
|
11
|
-
name: 'EdgeIQAPI Test Device',
|
|
12
|
-
unique_id: 'edge_api_js_test_device',
|
|
13
|
-
company_id: 'whiteprompt_ssi_dev',
|
|
14
|
-
};
|
package/dist/example/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const Greeter: (name: string) => string;
|