@bytexbyte/ike-app-api 1.0.75 → 1.0.76
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/lib/App.d.ts +3 -0
- package/lib/App.js +17 -0
- package/lib/TouHistory/index.d.ts +24 -0
- package/lib/TouHistory/index.js +109 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +2 -0
- package/package.json +2 -2
package/lib/App.d.ts
CHANGED
package/lib/App.js
CHANGED
|
@@ -136,6 +136,23 @@ var IKEAppApi = /** @class */ (function (_super) {
|
|
|
136
136
|
});
|
|
137
137
|
});
|
|
138
138
|
};
|
|
139
|
+
IKEAppApi.prototype.isShowToU = function (deviceId) {
|
|
140
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
141
|
+
var response;
|
|
142
|
+
return __generator(this, function (_a) {
|
|
143
|
+
switch (_a.label) {
|
|
144
|
+
case 0: return [4 /*yield*/, this.bxbFetch({
|
|
145
|
+
method: 'POST',
|
|
146
|
+
headers: { 'Content-Type': 'application/json' },
|
|
147
|
+
body: JSON.stringify({ deviceId: deviceId }),
|
|
148
|
+
}, "is-show-tou")];
|
|
149
|
+
case 1:
|
|
150
|
+
response = _a.sent();
|
|
151
|
+
return [2 /*return*/, response.json()];
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
});
|
|
155
|
+
};
|
|
139
156
|
return IKEAppApi;
|
|
140
157
|
}(bxb_api_1.default));
|
|
141
158
|
exports.default = IKEAppApi;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import BxBApi from '@bytexbyte/bxb-api';
|
|
2
|
+
declare class IKEAppToUHistoryApi extends BxBApi {
|
|
3
|
+
constructor({ host, credentials, onSuccess, onError, }: {
|
|
4
|
+
host: string;
|
|
5
|
+
credentials?: RequestCredentials;
|
|
6
|
+
onSuccess?: () => void;
|
|
7
|
+
onError?: (error: any) => void;
|
|
8
|
+
});
|
|
9
|
+
isShowToU(form: {
|
|
10
|
+
deviceId: string;
|
|
11
|
+
}): Promise<{
|
|
12
|
+
result: boolean;
|
|
13
|
+
} | {
|
|
14
|
+
error: 'Field(s) cannot be empty.' | 'TOU_VERSION is not defined.';
|
|
15
|
+
}>;
|
|
16
|
+
createToUHistory(form: {
|
|
17
|
+
deviceId: string;
|
|
18
|
+
}): Promise<{
|
|
19
|
+
success: boolean;
|
|
20
|
+
} | {
|
|
21
|
+
error: 'Field(s) cannot be empty.' | 'TOU_VERSION is not defined.' | 'History already exists.';
|
|
22
|
+
}>;
|
|
23
|
+
}
|
|
24
|
+
export default IKEAppToUHistoryApi;
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
18
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
19
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
20
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
21
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
22
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
23
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
27
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
28
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
29
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
30
|
+
function step(op) {
|
|
31
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
32
|
+
while (_) try {
|
|
33
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
34
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
35
|
+
switch (op[0]) {
|
|
36
|
+
case 0: case 1: t = op; break;
|
|
37
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
38
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
39
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
40
|
+
default:
|
|
41
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
42
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
43
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
44
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
45
|
+
if (t[2]) _.ops.pop();
|
|
46
|
+
_.trys.pop(); continue;
|
|
47
|
+
}
|
|
48
|
+
op = body.call(thisArg, _);
|
|
49
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
50
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
54
|
+
/* eslint-disable no-undef */
|
|
55
|
+
var bxb_api_1 = require("@bytexbyte/bxb-api");
|
|
56
|
+
var config_1 = require("../config");
|
|
57
|
+
var IKEAppToUHistoryApi = /** @class */ (function (_super) {
|
|
58
|
+
__extends(IKEAppToUHistoryApi, _super);
|
|
59
|
+
function IKEAppToUHistoryApi(_a) {
|
|
60
|
+
var host = _a.host, credentials = _a.credentials, onSuccess = _a.onSuccess, onError = _a.onError;
|
|
61
|
+
return _super.call(this, {
|
|
62
|
+
host: host,
|
|
63
|
+
secretKey: config_1.localSecretKey,
|
|
64
|
+
secret: '',
|
|
65
|
+
moduleName: 'rsa',
|
|
66
|
+
credentials: credentials,
|
|
67
|
+
onSuccess: onSuccess,
|
|
68
|
+
onError: onError,
|
|
69
|
+
}) || this;
|
|
70
|
+
}
|
|
71
|
+
IKEAppToUHistoryApi.prototype.isShowToU = function (form) {
|
|
72
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
73
|
+
var response;
|
|
74
|
+
return __generator(this, function (_a) {
|
|
75
|
+
switch (_a.label) {
|
|
76
|
+
case 0: return [4 /*yield*/, this.bxbFetch({
|
|
77
|
+
method: 'POST',
|
|
78
|
+
headers: { 'Content-Type': 'application/json' },
|
|
79
|
+
body: JSON.stringify(form),
|
|
80
|
+
}, 'is-show-tou')];
|
|
81
|
+
case 1:
|
|
82
|
+
response = _a.sent();
|
|
83
|
+
return [2 /*return*/, response.json()];
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
};
|
|
88
|
+
IKEAppToUHistoryApi.prototype.createToUHistory = function (form) {
|
|
89
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
90
|
+
var response;
|
|
91
|
+
return __generator(this, function (_a) {
|
|
92
|
+
switch (_a.label) {
|
|
93
|
+
case 0: return [4 /*yield*/, this.bxbFetch({
|
|
94
|
+
method: 'POST',
|
|
95
|
+
headers: {
|
|
96
|
+
'Content-Type': 'application/json',
|
|
97
|
+
},
|
|
98
|
+
body: JSON.stringify(form),
|
|
99
|
+
}, '')];
|
|
100
|
+
case 1:
|
|
101
|
+
response = _a.sent();
|
|
102
|
+
return [2 /*return*/, response.json()];
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
};
|
|
107
|
+
return IKEAppToUHistoryApi;
|
|
108
|
+
}(bxb_api_1.default));
|
|
109
|
+
exports.default = IKEAppToUHistoryApi;
|
package/lib/index.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ import IKEAppRegisterDeviceCodeApi from './RegisterDeviceCode';
|
|
|
14
14
|
import IKEAppRsaApi from './Rsa';
|
|
15
15
|
import IKEAppScanApi from './Scan';
|
|
16
16
|
import IKEAppTagsApi from './Tags';
|
|
17
|
+
import IKEAppToUHistoryApi from './TouHistory';
|
|
17
18
|
import IKEAppUserApi from './User';
|
|
18
19
|
declare class IKEAppApi {
|
|
19
20
|
host: string;
|
|
@@ -35,6 +36,7 @@ declare class IKEAppApi {
|
|
|
35
36
|
rsa: IKEAppRsaApi;
|
|
36
37
|
bleConnectionErrorLog: IKEAppBleConnectionErrorLogApi;
|
|
37
38
|
product: IKEAppProductApi;
|
|
39
|
+
touHistory: IKEAppToUHistoryApi;
|
|
38
40
|
constructor({ host, env, secretKey, secret, credentials, onSuccess, onError, }: {
|
|
39
41
|
host: string;
|
|
40
42
|
env: string;
|
package/lib/index.js
CHANGED
|
@@ -63,6 +63,7 @@ var RegisterDeviceCode_1 = require("./RegisterDeviceCode");
|
|
|
63
63
|
var Rsa_1 = require("./Rsa");
|
|
64
64
|
var Scan_1 = require("./Scan");
|
|
65
65
|
var Tags_1 = require("./Tags");
|
|
66
|
+
var TouHistory_1 = require("./TouHistory");
|
|
66
67
|
var User_1 = require("./User");
|
|
67
68
|
var IKEAppApi = /** @class */ (function () {
|
|
68
69
|
function IKEAppApi(_a) {
|
|
@@ -106,6 +107,7 @@ var IKEAppApi = /** @class */ (function () {
|
|
|
106
107
|
});
|
|
107
108
|
this.incode = new Incode_1.default({ host: host, secretKey: secretKey, secret: secret, credentials: credentials, onSuccess: onSuccess, onError: onError });
|
|
108
109
|
this.bleConnectionErrorLog = new BleConnectionErrorLog_1.default({ host: host, credentials: credentials, onSuccess: onSuccess, onError: onError });
|
|
110
|
+
this.touHistory = new TouHistory_1.default({ host: host, credentials: credentials, onSuccess: onSuccess, onError: onError });
|
|
109
111
|
}
|
|
110
112
|
return IKEAppApi;
|
|
111
113
|
}());
|
package/package.json
CHANGED