bkper-js 1.9.1 → 1.9.3
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/index.d.ts
CHANGED
|
@@ -751,9 +751,16 @@ export declare class Book {
|
|
|
751
751
|
getGroup(idOrName?: string): Promise<Group | undefined>;
|
|
752
752
|
/**
|
|
753
753
|
* Gets all [[Groups]] of this Book
|
|
754
|
+
*
|
|
755
|
+
* @returns The retrieved Group objects
|
|
754
756
|
*/
|
|
755
757
|
getGroups(): Promise<Group[]>;
|
|
756
758
|
private mapGroups;
|
|
759
|
+
/**
|
|
760
|
+
* Gets all [[Accounts]] of this Book
|
|
761
|
+
*
|
|
762
|
+
* @returns The retrieved Account objects
|
|
763
|
+
*/
|
|
757
764
|
getAccounts(): Promise<Account[]>;
|
|
758
765
|
private mapAccounts;
|
|
759
766
|
/**
|
|
@@ -838,6 +845,8 @@ export declare interface Config {
|
|
|
838
845
|
}>;
|
|
839
846
|
/**
|
|
840
847
|
* Custom request error handler
|
|
848
|
+
*
|
|
849
|
+
* @param error - The error object of the failed request.
|
|
841
850
|
*/
|
|
842
851
|
requestErrorHandler?: (error: any) => any;
|
|
843
852
|
/**
|
|
@@ -847,10 +856,10 @@ export declare interface Config {
|
|
|
847
856
|
* It provides the HTTP status code, error message, and the number of retry attempts made so far.
|
|
848
857
|
*
|
|
849
858
|
* @param code - The HTTP status code of the failed request.
|
|
850
|
-
* @param
|
|
859
|
+
* @param error - The error object of the failed request.
|
|
851
860
|
* @param attempt - The number of retry attempts made so far.
|
|
852
861
|
*/
|
|
853
|
-
requestRetryHandler?: (status?: number,
|
|
862
|
+
requestRetryHandler?: (status?: number, error?: any, attempt?: number) => Promise<void>;
|
|
854
863
|
/**
|
|
855
864
|
* Sets the base api url. Default to https://app.bkper.com/_ah/api/bkper
|
|
856
865
|
*/
|
|
@@ -895,6 +904,18 @@ export declare class Connection {
|
|
|
895
904
|
* @returns The Connection name
|
|
896
905
|
*/
|
|
897
906
|
getName(): string | undefined;
|
|
907
|
+
/**
|
|
908
|
+
* Gets the logo of the Connection.
|
|
909
|
+
*
|
|
910
|
+
* @returns The Connection logo
|
|
911
|
+
*/
|
|
912
|
+
getLogo(): string | undefined;
|
|
913
|
+
/**
|
|
914
|
+
* Gets the date when the Connection was added.
|
|
915
|
+
*
|
|
916
|
+
* @returns The Connection add date in milliseconds
|
|
917
|
+
*/
|
|
918
|
+
getDateAddedMs(): string | undefined;
|
|
898
919
|
/**
|
|
899
920
|
* Gets the email of the owner of the Connection.
|
|
900
921
|
*
|
|
@@ -999,9 +1020,15 @@ export declare class Connection {
|
|
|
999
1020
|
/**
|
|
1000
1021
|
* Performs create new Connection.
|
|
1001
1022
|
*
|
|
1002
|
-
* @returns The Connection, for chaining
|
|
1023
|
+
* @returns The created Connection, for chaining
|
|
1003
1024
|
*/
|
|
1004
1025
|
create(): Promise<Connection>;
|
|
1026
|
+
/**
|
|
1027
|
+
* Performs remove Connection.
|
|
1028
|
+
*
|
|
1029
|
+
* @returns The removed Connection object
|
|
1030
|
+
*/
|
|
1031
|
+
remove(): Promise<Connection>;
|
|
1005
1032
|
}
|
|
1006
1033
|
|
|
1007
1034
|
/**
|
package/lib/model/Book.js
CHANGED
|
@@ -540,6 +540,8 @@ export class Book {
|
|
|
540
540
|
}
|
|
541
541
|
/**
|
|
542
542
|
* Gets all [[Groups]] of this Book
|
|
543
|
+
*
|
|
544
|
+
* @returns The retrieved Group objects
|
|
543
545
|
*/
|
|
544
546
|
getGroups() {
|
|
545
547
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -561,6 +563,11 @@ export class Book {
|
|
|
561
563
|
}
|
|
562
564
|
return groupsObj;
|
|
563
565
|
}
|
|
566
|
+
/**
|
|
567
|
+
* Gets all [[Accounts]] of this Book
|
|
568
|
+
*
|
|
569
|
+
* @returns The retrieved Account objects
|
|
570
|
+
*/
|
|
564
571
|
getAccounts() {
|
|
565
572
|
return __awaiter(this, void 0, void 0, function* () {
|
|
566
573
|
if (this.idAccountMap) {
|
package/lib/model/Connection.js
CHANGED
|
@@ -59,6 +59,22 @@ export class Connection {
|
|
|
59
59
|
getName() {
|
|
60
60
|
return this.payload.name;
|
|
61
61
|
}
|
|
62
|
+
/**
|
|
63
|
+
* Gets the logo of the Connection.
|
|
64
|
+
*
|
|
65
|
+
* @returns The Connection logo
|
|
66
|
+
*/
|
|
67
|
+
getLogo() {
|
|
68
|
+
return this.payload.logo;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Gets the date when the Connection was added.
|
|
72
|
+
*
|
|
73
|
+
* @returns The Connection add date in milliseconds
|
|
74
|
+
*/
|
|
75
|
+
getDateAddedMs() {
|
|
76
|
+
return this.payload.dateAddedMs;
|
|
77
|
+
}
|
|
62
78
|
/**
|
|
63
79
|
* Gets the email of the owner of the Connection.
|
|
64
80
|
*
|
|
@@ -223,7 +239,7 @@ export class Connection {
|
|
|
223
239
|
/**
|
|
224
240
|
* Performs create new Connection.
|
|
225
241
|
*
|
|
226
|
-
* @returns The Connection, for chaining
|
|
242
|
+
* @returns The created Connection, for chaining
|
|
227
243
|
*/
|
|
228
244
|
create() {
|
|
229
245
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -231,5 +247,19 @@ export class Connection {
|
|
|
231
247
|
return this;
|
|
232
248
|
});
|
|
233
249
|
}
|
|
250
|
+
/**
|
|
251
|
+
* Performs remove Connection.
|
|
252
|
+
*
|
|
253
|
+
* @returns The removed Connection object
|
|
254
|
+
*/
|
|
255
|
+
remove() {
|
|
256
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
257
|
+
const connectionId = this.getId();
|
|
258
|
+
if (connectionId) {
|
|
259
|
+
this.payload = yield ConnectionService.deleteConnection(connectionId);
|
|
260
|
+
}
|
|
261
|
+
return this;
|
|
262
|
+
});
|
|
263
|
+
}
|
|
234
264
|
}
|
|
235
265
|
//# sourceMappingURL=Connection.js.map
|
|
@@ -29,14 +29,15 @@ export function deleteAccount(bookId, account) {
|
|
|
29
29
|
}
|
|
30
30
|
export function getAccount(bookId, idOrName) {
|
|
31
31
|
return __awaiter(this, void 0, void 0, function* () {
|
|
32
|
-
|
|
32
|
+
let response = yield new HttpBooksApiV5Request(`${bookId}/accounts/${encodeURIComponent(idOrName)}`).setMethod('GET').fetch();
|
|
33
33
|
return response.data;
|
|
34
34
|
});
|
|
35
35
|
}
|
|
36
36
|
export function getAccounts(bookId) {
|
|
37
37
|
return __awaiter(this, void 0, void 0, function* () {
|
|
38
|
-
var
|
|
39
|
-
|
|
38
|
+
var _a;
|
|
39
|
+
let response = yield new HttpBooksApiV5Request(`${bookId}/accounts`).setMethod('GET').fetch();
|
|
40
|
+
return ((_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.items) || [];
|
|
40
41
|
});
|
|
41
42
|
}
|
|
42
43
|
//# sourceMappingURL=account-service.js.map
|
|
@@ -52,7 +52,7 @@ export class HttpApiRequest extends HttpRequest {
|
|
|
52
52
|
}
|
|
53
53
|
return yield this.fetch();
|
|
54
54
|
}
|
|
55
|
-
throw this.handleError(errorResp);
|
|
55
|
+
throw this.handleError(errorResp.data);
|
|
56
56
|
}
|
|
57
57
|
else if (error.request) {
|
|
58
58
|
// The request was made but no response was received
|