bkper-js 1.9.2 → 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 +23 -3
- package/lib/model/Connection.js +31 -1
- package/lib/service/http-api-request.js +1 -1
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -845,6 +845,8 @@ export declare interface Config {
|
|
|
845
845
|
}>;
|
|
846
846
|
/**
|
|
847
847
|
* Custom request error handler
|
|
848
|
+
*
|
|
849
|
+
* @param error - The error object of the failed request.
|
|
848
850
|
*/
|
|
849
851
|
requestErrorHandler?: (error: any) => any;
|
|
850
852
|
/**
|
|
@@ -854,10 +856,10 @@ export declare interface Config {
|
|
|
854
856
|
* It provides the HTTP status code, error message, and the number of retry attempts made so far.
|
|
855
857
|
*
|
|
856
858
|
* @param code - The HTTP status code of the failed request.
|
|
857
|
-
* @param
|
|
859
|
+
* @param error - The error object of the failed request.
|
|
858
860
|
* @param attempt - The number of retry attempts made so far.
|
|
859
861
|
*/
|
|
860
|
-
requestRetryHandler?: (status?: number,
|
|
862
|
+
requestRetryHandler?: (status?: number, error?: any, attempt?: number) => Promise<void>;
|
|
861
863
|
/**
|
|
862
864
|
* Sets the base api url. Default to https://app.bkper.com/_ah/api/bkper
|
|
863
865
|
*/
|
|
@@ -902,6 +904,18 @@ export declare class Connection {
|
|
|
902
904
|
* @returns The Connection name
|
|
903
905
|
*/
|
|
904
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;
|
|
905
919
|
/**
|
|
906
920
|
* Gets the email of the owner of the Connection.
|
|
907
921
|
*
|
|
@@ -1006,9 +1020,15 @@ export declare class Connection {
|
|
|
1006
1020
|
/**
|
|
1007
1021
|
* Performs create new Connection.
|
|
1008
1022
|
*
|
|
1009
|
-
* @returns The Connection, for chaining
|
|
1023
|
+
* @returns The created Connection, for chaining
|
|
1010
1024
|
*/
|
|
1011
1025
|
create(): Promise<Connection>;
|
|
1026
|
+
/**
|
|
1027
|
+
* Performs remove Connection.
|
|
1028
|
+
*
|
|
1029
|
+
* @returns The removed Connection object
|
|
1030
|
+
*/
|
|
1031
|
+
remove(): Promise<Connection>;
|
|
1012
1032
|
}
|
|
1013
1033
|
|
|
1014
1034
|
/**
|
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
|
|
@@ -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
|