bkper-js 1.0.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/LICENSE +201 -0
- package/README.md +27 -0
- package/lib/index.d.ts +1804 -0
- package/lib/index.js +42 -0
- package/lib/model/Account.js +385 -0
- package/lib/model/Amount.js +295 -0
- package/lib/model/App.js +114 -0
- package/lib/model/Bkper.js +105 -0
- package/lib/model/Book.js +717 -0
- package/lib/model/Collection.js +43 -0
- package/lib/model/Config.js +3 -0
- package/lib/model/Connection.js +261 -0
- package/lib/model/Enums.js +138 -0
- package/lib/model/File.js +128 -0
- package/lib/model/Group.js +248 -0
- package/lib/model/Integration.js +112 -0
- package/lib/model/Transaction.js +719 -0
- package/lib/model/TransactionIterator.js +154 -0
- package/lib/model/TransactionPage.js +97 -0
- package/lib/model/User.js +97 -0
- package/lib/service/account-service.js +42 -0
- package/lib/service/app-service.js +34 -0
- package/lib/service/balances-service.js +20 -0
- package/lib/service/book-service.js +36 -0
- package/lib/service/connection-service.js +71 -0
- package/lib/service/file-service.js +27 -0
- package/lib/service/group-service.js +71 -0
- package/lib/service/http-api-request.js +165 -0
- package/lib/service/integration-service.js +52 -0
- package/lib/service/transaction-service.js +114 -0
- package/lib/service/user-service.js +20 -0
- package/lib/tsdoc-metadata.json +11 -0
- package/lib/utils.js +341 -0
- package/package.json +58 -0
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Amount = void 0;
|
|
7
|
+
const big_js_1 = __importDefault(require("big.js"));
|
|
8
|
+
/**
|
|
9
|
+
* This class defines an Amount for arbitrary-precision decimal arithmetic.
|
|
10
|
+
*
|
|
11
|
+
* It inherits methods from [big.js](http://mikemcl.github.io/big.js/) library
|
|
12
|
+
*
|
|
13
|
+
* @public
|
|
14
|
+
*/
|
|
15
|
+
class Amount {
|
|
16
|
+
/**
|
|
17
|
+
* The Amount constructor.
|
|
18
|
+
*/
|
|
19
|
+
constructor(n) {
|
|
20
|
+
this.checkNumberNotNull(n);
|
|
21
|
+
if (typeof n == "string") {
|
|
22
|
+
this.wrapped = new big_js_1.default(n);
|
|
23
|
+
}
|
|
24
|
+
else if (n instanceof Amount) {
|
|
25
|
+
this.wrapped = new big_js_1.default(n.wrapped);
|
|
26
|
+
}
|
|
27
|
+
else if (n.toString) {
|
|
28
|
+
this.wrapped = new big_js_1.default(n.toString());
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
this.wrapped = new big_js_1.default(+n);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Returns an absolute Amount.
|
|
36
|
+
*/
|
|
37
|
+
abs() {
|
|
38
|
+
let big = this.wrapped.abs();
|
|
39
|
+
return this.wrap(big);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Compare
|
|
43
|
+
*/
|
|
44
|
+
cmp(n) {
|
|
45
|
+
this.checkNumberNotNull(n);
|
|
46
|
+
if (typeof n == "string") {
|
|
47
|
+
return this.wrapped.cmp(n);
|
|
48
|
+
}
|
|
49
|
+
else if (n instanceof Amount) {
|
|
50
|
+
return this.wrapped.cmp(n.wrapped);
|
|
51
|
+
}
|
|
52
|
+
else if (n.toString) {
|
|
53
|
+
return this.wrapped.cmp(n.toString());
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
return this.wrapped.cmp(+n);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Divide by
|
|
61
|
+
*/
|
|
62
|
+
div(n) {
|
|
63
|
+
this.checkNumberNotNull(n);
|
|
64
|
+
let big;
|
|
65
|
+
if (typeof n == "string") {
|
|
66
|
+
big = this.wrapped.div(n);
|
|
67
|
+
}
|
|
68
|
+
else if (n instanceof Amount) {
|
|
69
|
+
big = this.wrapped.div(n.wrapped);
|
|
70
|
+
}
|
|
71
|
+
else if (n.toString) {
|
|
72
|
+
big = this.wrapped.div(n.toString());
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
big = this.wrapped.div(+n);
|
|
76
|
+
}
|
|
77
|
+
return this.wrap(big);
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Equals to
|
|
81
|
+
*/
|
|
82
|
+
eq(n) {
|
|
83
|
+
this.checkNumberNotNull(n);
|
|
84
|
+
if (typeof n == "string") {
|
|
85
|
+
return this.wrapped.eq(n);
|
|
86
|
+
}
|
|
87
|
+
else if (n instanceof Amount) {
|
|
88
|
+
return this.wrapped.eq(n.wrapped);
|
|
89
|
+
}
|
|
90
|
+
else if (n.toString) {
|
|
91
|
+
return this.wrapped.eq(n.toString());
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
return this.wrapped.eq(+n);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Greater than
|
|
99
|
+
*/
|
|
100
|
+
gt(n) {
|
|
101
|
+
this.checkNumberNotNull(n);
|
|
102
|
+
if (typeof n == "string") {
|
|
103
|
+
return this.wrapped.gt(n);
|
|
104
|
+
}
|
|
105
|
+
else if (n instanceof Amount) {
|
|
106
|
+
return this.wrapped.gt(n.wrapped);
|
|
107
|
+
}
|
|
108
|
+
else if (n.toString) {
|
|
109
|
+
return this.wrapped.gt(n.toString());
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
return this.wrapped.gt(+n);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Greater than or equal
|
|
117
|
+
*/
|
|
118
|
+
gte(n) {
|
|
119
|
+
this.checkNumberNotNull(n);
|
|
120
|
+
if (typeof n == "string") {
|
|
121
|
+
return this.wrapped.gte(n);
|
|
122
|
+
}
|
|
123
|
+
else if (n instanceof Amount) {
|
|
124
|
+
return this.wrapped.gte(n.wrapped);
|
|
125
|
+
}
|
|
126
|
+
else if (n.toString) {
|
|
127
|
+
return this.wrapped.gte(n.toString());
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
return this.wrapped.gte(+n);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Less than
|
|
135
|
+
*/
|
|
136
|
+
lt(n) {
|
|
137
|
+
this.checkNumberNotNull(n);
|
|
138
|
+
if (typeof n == "string") {
|
|
139
|
+
return this.wrapped.lt(n);
|
|
140
|
+
}
|
|
141
|
+
else if (n instanceof Amount) {
|
|
142
|
+
return this.wrapped.lt(n.wrapped);
|
|
143
|
+
}
|
|
144
|
+
else if (n.toString) {
|
|
145
|
+
return this.wrapped.lt(n.toString());
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
return this.wrapped.lt(+n);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Less than or equal to
|
|
153
|
+
*/
|
|
154
|
+
lte(n) {
|
|
155
|
+
this.checkNumberNotNull(n);
|
|
156
|
+
if (typeof n == "string") {
|
|
157
|
+
return this.wrapped.lte(n);
|
|
158
|
+
}
|
|
159
|
+
else if (n instanceof Amount) {
|
|
160
|
+
return this.wrapped.lte(n.wrapped);
|
|
161
|
+
}
|
|
162
|
+
else if (n.toString) {
|
|
163
|
+
return this.wrapped.lte(n.toString());
|
|
164
|
+
}
|
|
165
|
+
else {
|
|
166
|
+
return this.wrapped.lte(+n);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Sum
|
|
171
|
+
*/
|
|
172
|
+
plus(n) {
|
|
173
|
+
this.checkNumberNotNull(n);
|
|
174
|
+
let big;
|
|
175
|
+
if (typeof n == "string") {
|
|
176
|
+
big = this.wrapped.plus(n);
|
|
177
|
+
}
|
|
178
|
+
else if (n instanceof Amount) {
|
|
179
|
+
big = this.wrapped.plus(n.wrapped);
|
|
180
|
+
}
|
|
181
|
+
else if (n.toString) {
|
|
182
|
+
big = this.wrapped.plus(n.toString());
|
|
183
|
+
}
|
|
184
|
+
else {
|
|
185
|
+
big = this.wrapped.plus(+n);
|
|
186
|
+
}
|
|
187
|
+
return this.wrap(big);
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Minus
|
|
191
|
+
*/
|
|
192
|
+
minus(n) {
|
|
193
|
+
this.checkNumberNotNull(n);
|
|
194
|
+
let big;
|
|
195
|
+
if (typeof n == "string") {
|
|
196
|
+
big = this.wrapped.minus(n);
|
|
197
|
+
}
|
|
198
|
+
else if (n instanceof Amount) {
|
|
199
|
+
big = this.wrapped.minus(n.wrapped);
|
|
200
|
+
}
|
|
201
|
+
else if (n.toString) {
|
|
202
|
+
big = this.wrapped.minus(n.toString());
|
|
203
|
+
}
|
|
204
|
+
else {
|
|
205
|
+
big = this.wrapped.minus(+n);
|
|
206
|
+
}
|
|
207
|
+
return this.wrap(big);
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Modulo - the integer remainder of dividing this Amount by n.
|
|
211
|
+
*
|
|
212
|
+
* Similar to % operator
|
|
213
|
+
*
|
|
214
|
+
*/
|
|
215
|
+
mod(n) {
|
|
216
|
+
this.checkNumberNotNull(n);
|
|
217
|
+
let big;
|
|
218
|
+
if (typeof n == "string") {
|
|
219
|
+
big = this.wrapped.mod(n);
|
|
220
|
+
}
|
|
221
|
+
else if (n instanceof Amount) {
|
|
222
|
+
big = this.wrapped.mod(n.wrapped);
|
|
223
|
+
}
|
|
224
|
+
else if (n.toString) {
|
|
225
|
+
big = this.wrapped.mod(n.toString());
|
|
226
|
+
}
|
|
227
|
+
else {
|
|
228
|
+
big = this.wrapped.mod(+n);
|
|
229
|
+
}
|
|
230
|
+
return this.wrap(big);
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Round to a maximum of dp decimal places.
|
|
234
|
+
*/
|
|
235
|
+
round(dp) {
|
|
236
|
+
let big = this.wrapped.round(dp);
|
|
237
|
+
return this.wrap(big);
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Multiply
|
|
241
|
+
*/
|
|
242
|
+
times(n) {
|
|
243
|
+
this.checkNumberNotNull(n);
|
|
244
|
+
let big;
|
|
245
|
+
if (typeof n == "string") {
|
|
246
|
+
big = this.wrapped.times(n);
|
|
247
|
+
}
|
|
248
|
+
else if (n instanceof Amount) {
|
|
249
|
+
big = this.wrapped.times(n.wrapped);
|
|
250
|
+
}
|
|
251
|
+
else if (n.toString) {
|
|
252
|
+
big = this.wrapped.times(n.toString());
|
|
253
|
+
}
|
|
254
|
+
else {
|
|
255
|
+
big = this.wrapped.times(+n);
|
|
256
|
+
}
|
|
257
|
+
return this.wrap(big);
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* Returns a string representing the value of this Amount in normal notation to a fixed number of decimal places dp.
|
|
261
|
+
*/
|
|
262
|
+
toFixed(dp) {
|
|
263
|
+
return this.wrapped.toFixed(dp);
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* Returns a string representing the value of this Amount.
|
|
267
|
+
*/
|
|
268
|
+
toString() {
|
|
269
|
+
return this.wrapped.toString();
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* Returns a primitive number representing the value of this Amount.
|
|
273
|
+
*/
|
|
274
|
+
toNumber() {
|
|
275
|
+
return this.wrapped.toNumber();
|
|
276
|
+
}
|
|
277
|
+
/** @internal */
|
|
278
|
+
checkNumberNotNull(amount) {
|
|
279
|
+
if (amount == null) {
|
|
280
|
+
throw new Error(`Invalid number: null`);
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
/** @internal */
|
|
284
|
+
static create() {
|
|
285
|
+
return Object.create(this.prototype);
|
|
286
|
+
}
|
|
287
|
+
/** @internal */
|
|
288
|
+
wrap(big) {
|
|
289
|
+
let amount = Amount.create();
|
|
290
|
+
amount.wrapped = big;
|
|
291
|
+
return amount;
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
exports.Amount = Amount;
|
|
295
|
+
//# sourceMappingURL=Amount.js.map
|
package/lib/model/App.js
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.App = void 0;
|
|
13
|
+
const app_service_1 = require("../service/app-service");
|
|
14
|
+
/**
|
|
15
|
+
* Defines an App on Bkper.
|
|
16
|
+
*
|
|
17
|
+
* Apps can be installed on Books by users.
|
|
18
|
+
*
|
|
19
|
+
* @public
|
|
20
|
+
*/
|
|
21
|
+
class App {
|
|
22
|
+
constructor(json) {
|
|
23
|
+
this.wrapped = json;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
*
|
|
27
|
+
* Sets the webhook url for development.
|
|
28
|
+
*
|
|
29
|
+
* @returns This App, for chainning.
|
|
30
|
+
*/
|
|
31
|
+
setWebhookUrlDev(webhookUrlDev) {
|
|
32
|
+
if (webhookUrlDev) {
|
|
33
|
+
this.wrapped.webhookUrlDev = webhookUrlDev;
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
this.wrapped.webhookUrlDev = 'null';
|
|
37
|
+
}
|
|
38
|
+
return this;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
*
|
|
42
|
+
* @returns The App universal identifier
|
|
43
|
+
*/
|
|
44
|
+
getId() {
|
|
45
|
+
return this.wrapped.id;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Sets the whitelabeled user emails
|
|
49
|
+
*
|
|
50
|
+
* @returns This App for chaining
|
|
51
|
+
*/
|
|
52
|
+
setUserEmails(emails) {
|
|
53
|
+
this.wrapped.userEmails = emails;
|
|
54
|
+
return this;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Sets the developer email
|
|
58
|
+
*
|
|
59
|
+
* @returns This App for chaining
|
|
60
|
+
*/
|
|
61
|
+
setDeveloperEmail(email) {
|
|
62
|
+
this.wrapped.developerEmail = email;
|
|
63
|
+
return this;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Sets the client secret
|
|
67
|
+
*
|
|
68
|
+
* @returns This App for chaining
|
|
69
|
+
*/
|
|
70
|
+
setClientSecret(clientSecret) {
|
|
71
|
+
this.wrapped.clientSecret = clientSecret;
|
|
72
|
+
return this;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Sets the readme text
|
|
76
|
+
*
|
|
77
|
+
* @returns This App for chaining
|
|
78
|
+
*/
|
|
79
|
+
setReadme(readme) {
|
|
80
|
+
this.wrapped.readme = readme;
|
|
81
|
+
return this;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Performs the app creation, applying pending changes.
|
|
85
|
+
*
|
|
86
|
+
* The App id MUST be unique. If another app is already existing, an error will be thrown.
|
|
87
|
+
*/
|
|
88
|
+
create() {
|
|
89
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
90
|
+
yield (0, app_service_1.createApp)(this.wrapped);
|
|
91
|
+
return this;
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Partially update an App, applying pending changes.
|
|
96
|
+
*/
|
|
97
|
+
patch() {
|
|
98
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
99
|
+
yield (0, app_service_1.patchApp)(this.wrapped);
|
|
100
|
+
return this;
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Perform update App, applying pending changes.
|
|
105
|
+
*/
|
|
106
|
+
update() {
|
|
107
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
108
|
+
yield (0, app_service_1.updateApp)(this.wrapped);
|
|
109
|
+
return this;
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
exports.App = App;
|
|
114
|
+
//# sourceMappingURL=App.js.map
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
+
exports.Bkper = void 0;
|
|
36
|
+
const Book_1 = require("./Book");
|
|
37
|
+
const App_1 = require("./App");
|
|
38
|
+
const BookService = __importStar(require("../service/book-service"));
|
|
39
|
+
const UserService = __importStar(require("../service/user-service"));
|
|
40
|
+
const http_api_request_1 = require("../service/http-api-request");
|
|
41
|
+
const User_1 = require("./User");
|
|
42
|
+
/**
|
|
43
|
+
* This is the main Entry Point of the [bkper-node](https://www.npmjs.com/package/bkper) library.
|
|
44
|
+
*
|
|
45
|
+
* @public
|
|
46
|
+
*/
|
|
47
|
+
class Bkper {
|
|
48
|
+
/**
|
|
49
|
+
* Gets the [[Book]] with the specified bookId from url param.
|
|
50
|
+
*
|
|
51
|
+
* @param id - The universal book id - The same bookId param of URL you access at app.bkper.com
|
|
52
|
+
*
|
|
53
|
+
* @returns The retrieved Book, for chaining
|
|
54
|
+
*/
|
|
55
|
+
static getBook(id) {
|
|
56
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
57
|
+
let book = yield BookService.loadBook(id);
|
|
58
|
+
return new Book_1.Book(book);
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Gets the current logged [[User]].
|
|
63
|
+
*
|
|
64
|
+
* @returns The retrieved User, for chaining
|
|
65
|
+
*/
|
|
66
|
+
static getUser() {
|
|
67
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
68
|
+
let user = yield UserService.getUser();
|
|
69
|
+
return new User_1.User(user);
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Sets the API [[Config]] object.
|
|
74
|
+
*
|
|
75
|
+
* @param config - The Config object
|
|
76
|
+
*/
|
|
77
|
+
static setConfig(config) {
|
|
78
|
+
http_api_request_1.HttpApiRequest.config = config;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Sets the API key to identify the agent.
|
|
82
|
+
*
|
|
83
|
+
* @param key - The API key
|
|
84
|
+
*
|
|
85
|
+
* @returns The defined [[App]] object
|
|
86
|
+
*
|
|
87
|
+
* @deprecated Use `setConfig()` instead
|
|
88
|
+
*/
|
|
89
|
+
static setApiKey(key) {
|
|
90
|
+
http_api_request_1.HttpApiRequest.config.apiKeyProvider = () => __awaiter(this, void 0, void 0, function* () { return key; });
|
|
91
|
+
return new App_1.App({});
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Sets the provider of the valid OAuth2 access token
|
|
95
|
+
*
|
|
96
|
+
* @deprecated Use `setConfig()` instead
|
|
97
|
+
*/
|
|
98
|
+
static setOAuthTokenProvider(oauthTokenProvider) {
|
|
99
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
100
|
+
http_api_request_1.HttpApiRequest.config.oauthTokenProvider = oauthTokenProvider;
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
exports.Bkper = Bkper;
|
|
105
|
+
//# sourceMappingURL=Bkper.js.map
|