skikrumb-api 1.2.9 → 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 CHANGED
@@ -5,6 +5,7 @@ export declare const skiKrumb: (options?: {
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[]>;
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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "skikrumb-api",
3
- "version": "1.2.9",
3
+ "version": "1.3.0",
4
4
  "description": "Wrapper for the skiKrumb API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",