skikrumb-api 1.2.8 → 1.3.0
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/index.d.ts +3 -2
- package/dist/index.js +25 -0
- package/dist/models.d.ts +7 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import { apiKeys, Device, QueryDevice } from "./models";
|
|
1
|
+
import { apiKeys, Device, Gateways, QueryDevice } from "./models";
|
|
2
2
|
export declare const skiKrumb: (options?: {
|
|
3
3
|
apiKey: string;
|
|
4
4
|
requestedWith: string | undefined;
|
|
5
5
|
url: string | undefined;
|
|
6
6
|
}) => {
|
|
7
7
|
createDevice: (deveui: string, serialNumber: string) => Promise<any>;
|
|
8
|
+
createDeviceDownlink: (deveui: string, type?: string) => Promise<any>;
|
|
8
9
|
createPaymentIntent: (form: any) => Promise<any>;
|
|
9
10
|
createPrePurchaseIntent: (form: any) => Promise<any>;
|
|
10
11
|
readApiKeys: () => Promise<apiKeys[]>;
|
|
11
12
|
readDataForDevices: (query: QueryDevice) => Promise<Device[]>;
|
|
12
13
|
readDeviceDailyDistance: (serialNumber: string, query: QueryDevice) => Promise<Device[]>;
|
|
13
14
|
readDeviceData: (serialNumber: string, query: QueryDevice) => Promise<Device>;
|
|
14
|
-
readGateways: () => Promise<
|
|
15
|
+
readGateways: () => Promise<Gateways>;
|
|
15
16
|
};
|
package/dist/index.js
CHANGED
|
@@ -34,6 +34,30 @@ export const skiKrumb = (options = {
|
|
|
34
34
|
json: { deveui: deveui, serial_number: serialNumber }
|
|
35
35
|
}).json();
|
|
36
36
|
});
|
|
37
|
+
const createDeviceDownlink = (deveui, type = 'beep') => __awaiter(void 0, void 0, void 0, function* () {
|
|
38
|
+
if (!deveui || !type)
|
|
39
|
+
throw new Error('Must pass Lora MAC (deveui) and message type');
|
|
40
|
+
let message = 'DAgAC04zKE9EPTEwKQ0K';
|
|
41
|
+
switch (type) {
|
|
42
|
+
case 'help-off':
|
|
43
|
+
message = 'DBECAAAAAAAAAAAB';
|
|
44
|
+
break;
|
|
45
|
+
}
|
|
46
|
+
return yield api.post(`${options.url}/devices/downlink`, {
|
|
47
|
+
headers: {
|
|
48
|
+
'content-type': 'application/json'
|
|
49
|
+
},
|
|
50
|
+
json: {
|
|
51
|
+
'device': deveui,
|
|
52
|
+
'data': {
|
|
53
|
+
'params': {
|
|
54
|
+
'data': message,
|
|
55
|
+
'port': 100
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}).json();
|
|
60
|
+
});
|
|
37
61
|
const createPaymentIntent = (form) => __awaiter(void 0, void 0, void 0, function* () {
|
|
38
62
|
if (!form)
|
|
39
63
|
throw new Error('Form values not posted.');
|
|
@@ -77,6 +101,7 @@ export const skiKrumb = (options = {
|
|
|
77
101
|
});
|
|
78
102
|
return {
|
|
79
103
|
createDevice,
|
|
104
|
+
createDeviceDownlink,
|
|
80
105
|
createPaymentIntent,
|
|
81
106
|
createPrePurchaseIntent,
|
|
82
107
|
readApiKeys,
|
package/dist/models.d.ts
CHANGED
|
@@ -35,6 +35,13 @@ export interface Feature {
|
|
|
35
35
|
difficulty: string;
|
|
36
36
|
description: string;
|
|
37
37
|
}
|
|
38
|
+
export interface Gateways {
|
|
39
|
+
id: string;
|
|
40
|
+
boundary_file: string;
|
|
41
|
+
gateway: string;
|
|
42
|
+
name: string;
|
|
43
|
+
description: string;
|
|
44
|
+
}
|
|
38
45
|
export interface QueryDevice {
|
|
39
46
|
serial_numbers?: string;
|
|
40
47
|
serial_number?: string;
|