bkper-js 1.22.0 → 1.23.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/lib/index.d.ts +19 -0
- package/lib/model/App.js +18 -0
- package/lib/model/Book.js +16 -0
- package/lib/service/book-service.js +7 -0
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -362,6 +362,18 @@ export declare class App {
|
|
|
362
362
|
* @returns The App universal identifier
|
|
363
363
|
*/
|
|
364
364
|
getId(): string | undefined;
|
|
365
|
+
/**
|
|
366
|
+
* @return The name of this App
|
|
367
|
+
*/
|
|
368
|
+
getName(): string | undefined;
|
|
369
|
+
/**
|
|
370
|
+
* @return The logo url of this App
|
|
371
|
+
*/
|
|
372
|
+
getLogoUrl(): string | undefined;
|
|
373
|
+
/**
|
|
374
|
+
* @return The description of this App
|
|
375
|
+
*/
|
|
376
|
+
getDescription(): string | undefined;
|
|
365
377
|
/**
|
|
366
378
|
* Sets the whitelabeled user emails
|
|
367
379
|
*
|
|
@@ -660,6 +672,7 @@ export declare class Book {
|
|
|
660
672
|
|
|
661
673
|
|
|
662
674
|
|
|
675
|
+
|
|
663
676
|
constructor(payload?: bkper.Book);
|
|
664
677
|
/**
|
|
665
678
|
* @returns An immutable copy of the json payload
|
|
@@ -905,6 +918,12 @@ export declare class Book {
|
|
|
905
918
|
* Trigger [Balances Audit](https://help.bkper.com/en/articles/4412038-balances-audit) async process.
|
|
906
919
|
*/
|
|
907
920
|
audit(): void;
|
|
921
|
+
/**
|
|
922
|
+
* Retrieve installed [[Apps]] for this Book
|
|
923
|
+
*
|
|
924
|
+
* @returns The Apps objects
|
|
925
|
+
*/
|
|
926
|
+
getApps(): Promise<App[]>;
|
|
908
927
|
/**
|
|
909
928
|
* Gets the existing [[Integrations]] in the Book.
|
|
910
929
|
*
|
package/lib/model/App.js
CHANGED
|
@@ -47,6 +47,24 @@ export class App {
|
|
|
47
47
|
getId() {
|
|
48
48
|
return this.payload.id;
|
|
49
49
|
}
|
|
50
|
+
/**
|
|
51
|
+
* @return The name of this App
|
|
52
|
+
*/
|
|
53
|
+
getName() {
|
|
54
|
+
return this.payload.name;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* @return The logo url of this App
|
|
58
|
+
*/
|
|
59
|
+
getLogoUrl() {
|
|
60
|
+
return this.payload.logoUrl;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* @return The description of this App
|
|
64
|
+
*/
|
|
65
|
+
getDescription() {
|
|
66
|
+
return this.payload.description;
|
|
67
|
+
}
|
|
50
68
|
/**
|
|
51
69
|
* Sets the whitelabeled user emails
|
|
52
70
|
*
|
package/lib/model/Book.js
CHANGED
|
@@ -26,6 +26,7 @@ import { Integration } from './Integration.js';
|
|
|
26
26
|
import { Transaction } from './Transaction.js';
|
|
27
27
|
import { TransactionList } from './TransactionList.js';
|
|
28
28
|
import { BalancesReport } from './BalancesReport.js';
|
|
29
|
+
import { App } from './App.js';
|
|
29
30
|
/**
|
|
30
31
|
*
|
|
31
32
|
* A Book represents [General Ledger](https://en.wikipedia.org/wiki/General_ledger) for a company or business, but can also represent a [Ledger](https://en.wikipedia.org/wiki/Ledger) for a project or department
|
|
@@ -430,6 +431,21 @@ export class Book {
|
|
|
430
431
|
audit() {
|
|
431
432
|
BookService.audit(this.getId());
|
|
432
433
|
}
|
|
434
|
+
/**
|
|
435
|
+
* Retrieve installed [[Apps]] for this Book
|
|
436
|
+
*
|
|
437
|
+
* @returns The Apps objects
|
|
438
|
+
*/
|
|
439
|
+
getApps() {
|
|
440
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
441
|
+
if (this.apps != null) {
|
|
442
|
+
return this.apps;
|
|
443
|
+
}
|
|
444
|
+
const appsPlain = yield BookService.getApps(this.getId());
|
|
445
|
+
this.apps = appsPlain.map(a => new App(a));
|
|
446
|
+
return this.apps;
|
|
447
|
+
});
|
|
448
|
+
}
|
|
433
449
|
/**
|
|
434
450
|
* Gets the existing [[Integrations]] in the Book.
|
|
435
451
|
*
|
|
@@ -49,4 +49,11 @@ export function audit(bookId) {
|
|
|
49
49
|
new HttpBooksApiV5Request(`${bookId}/audit`).setMethod('PATCH').fetch();
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
|
+
export function getApps(bookId) {
|
|
53
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
54
|
+
var _a;
|
|
55
|
+
let response = yield new HttpBooksApiV5Request(`${bookId}/apps`).setMethod('GET').fetch();
|
|
56
|
+
return ((_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.items) || [];
|
|
57
|
+
});
|
|
58
|
+
}
|
|
52
59
|
//# sourceMappingURL=book-service.js.map
|