bkper-js 1.3.0 → 1.5.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 +59 -0
- package/lib/model/Bkper.js +15 -0
- package/lib/model/Book.js +11 -0
- package/lib/model/User.js +54 -0
- package/lib/service/book-service.js +6 -0
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -387,6 +387,19 @@ export declare class App {
|
|
|
387
387
|
* @public
|
|
388
388
|
*/
|
|
389
389
|
export declare class Bkper {
|
|
390
|
+
/**
|
|
391
|
+
* Instantiate a new [[Book]]
|
|
392
|
+
*
|
|
393
|
+
* Example:
|
|
394
|
+
* ```js
|
|
395
|
+
* var book = Bkper.newBook()
|
|
396
|
+
* .setName('My New Book')
|
|
397
|
+
* .setFractionDigits(2)
|
|
398
|
+
* .setDecimalSeparator('DOT')
|
|
399
|
+
* .create();
|
|
400
|
+
* ```
|
|
401
|
+
*/
|
|
402
|
+
static newBook(): Book;
|
|
390
403
|
/**
|
|
391
404
|
* Gets the [[Book]] with the specified bookId from url param.
|
|
392
405
|
*
|
|
@@ -828,6 +841,12 @@ export declare class Book {
|
|
|
828
841
|
* Retrieve a file by id
|
|
829
842
|
*/
|
|
830
843
|
getFile(id: string): Promise<File>;
|
|
844
|
+
/**
|
|
845
|
+
* Performs create new Book.
|
|
846
|
+
*
|
|
847
|
+
* @returns The created Book object
|
|
848
|
+
*/
|
|
849
|
+
create(): Promise<Book>;
|
|
831
850
|
/**
|
|
832
851
|
* Perform update Book, applying pending changes.
|
|
833
852
|
*/
|
|
@@ -1824,6 +1843,10 @@ export declare class TransactionIterator {
|
|
|
1824
1843
|
export declare class User {
|
|
1825
1844
|
|
|
1826
1845
|
constructor(json?: bkper.User);
|
|
1846
|
+
/**
|
|
1847
|
+
* @returns The wrapped plain json object
|
|
1848
|
+
*/
|
|
1849
|
+
json(): bkper.User;
|
|
1827
1850
|
/**
|
|
1828
1851
|
* Gets the id of the User.
|
|
1829
1852
|
*
|
|
@@ -1842,6 +1865,42 @@ export declare class User {
|
|
|
1842
1865
|
* @returns The User's full name
|
|
1843
1866
|
*/
|
|
1844
1867
|
getFullName(): string | undefined;
|
|
1868
|
+
/**
|
|
1869
|
+
* Gets the email of the User.
|
|
1870
|
+
*
|
|
1871
|
+
* @returns The User's email
|
|
1872
|
+
*/
|
|
1873
|
+
getEmail(): string | undefined;
|
|
1874
|
+
/**
|
|
1875
|
+
* Gets the hosted domain of the User.
|
|
1876
|
+
*
|
|
1877
|
+
* @returns The User's hosted domain
|
|
1878
|
+
*/
|
|
1879
|
+
getHostedDomain(): string | undefined;
|
|
1880
|
+
/**
|
|
1881
|
+
* Tells if the User is in the free plan.
|
|
1882
|
+
*
|
|
1883
|
+
* @returns True if the User is in the free plan
|
|
1884
|
+
*/
|
|
1885
|
+
isFree(): boolean | undefined;
|
|
1886
|
+
/**
|
|
1887
|
+
* Tells if the User has started the trial.
|
|
1888
|
+
*
|
|
1889
|
+
* @returns True if the User has started the trial
|
|
1890
|
+
*/
|
|
1891
|
+
hasStartedTrial(): boolean | undefined;
|
|
1892
|
+
/**
|
|
1893
|
+
* Gets the days left in User's trial.
|
|
1894
|
+
*
|
|
1895
|
+
* @returns The User's days left in trial
|
|
1896
|
+
*/
|
|
1897
|
+
getDaysLeftInTrial(): number | undefined;
|
|
1898
|
+
/**
|
|
1899
|
+
* Tells if the User has already used [[Connections]].
|
|
1900
|
+
*
|
|
1901
|
+
* @returns True if the User has already used Connections
|
|
1902
|
+
*/
|
|
1903
|
+
hasUsedConnections(): boolean | undefined;
|
|
1845
1904
|
/**
|
|
1846
1905
|
* Gets the [[Connections]] of the User.
|
|
1847
1906
|
*
|
package/lib/model/Bkper.js
CHANGED
|
@@ -32,6 +32,21 @@ import { User } from "./User.js";
|
|
|
32
32
|
* @public
|
|
33
33
|
*/
|
|
34
34
|
export class Bkper {
|
|
35
|
+
/**
|
|
36
|
+
* Instantiate a new [[Book]]
|
|
37
|
+
*
|
|
38
|
+
* Example:
|
|
39
|
+
* ```js
|
|
40
|
+
* var book = Bkper.newBook()
|
|
41
|
+
* .setName('My New Book')
|
|
42
|
+
* .setFractionDigits(2)
|
|
43
|
+
* .setDecimalSeparator('DOT')
|
|
44
|
+
* .create();
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
static newBook() {
|
|
48
|
+
return new Book();
|
|
49
|
+
}
|
|
35
50
|
/**
|
|
36
51
|
* Gets the [[Book]] with the specified bookId from url param.
|
|
37
52
|
*
|
package/lib/model/Book.js
CHANGED
|
@@ -689,6 +689,17 @@ export class Book {
|
|
|
689
689
|
return file;
|
|
690
690
|
});
|
|
691
691
|
}
|
|
692
|
+
/**
|
|
693
|
+
* Performs create new Book.
|
|
694
|
+
*
|
|
695
|
+
* @returns The created Book object
|
|
696
|
+
*/
|
|
697
|
+
create() {
|
|
698
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
699
|
+
this.wrapped = yield BookService.createBook(this.wrapped);
|
|
700
|
+
return this;
|
|
701
|
+
});
|
|
702
|
+
}
|
|
692
703
|
/**
|
|
693
704
|
* Perform update Book, applying pending changes.
|
|
694
705
|
*/
|
package/lib/model/User.js
CHANGED
|
@@ -20,6 +20,12 @@ export class User {
|
|
|
20
20
|
this.wrapped = {};
|
|
21
21
|
this.wrapped = json || {};
|
|
22
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* @returns The wrapped plain json object
|
|
25
|
+
*/
|
|
26
|
+
json() {
|
|
27
|
+
return this.wrapped;
|
|
28
|
+
}
|
|
23
29
|
/**
|
|
24
30
|
* Gets the id of the User.
|
|
25
31
|
*
|
|
@@ -44,6 +50,54 @@ export class User {
|
|
|
44
50
|
getFullName() {
|
|
45
51
|
return this.wrapped.fullName;
|
|
46
52
|
}
|
|
53
|
+
/**
|
|
54
|
+
* Gets the email of the User.
|
|
55
|
+
*
|
|
56
|
+
* @returns The User's email
|
|
57
|
+
*/
|
|
58
|
+
getEmail() {
|
|
59
|
+
return this.wrapped.email;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Gets the hosted domain of the User.
|
|
63
|
+
*
|
|
64
|
+
* @returns The User's hosted domain
|
|
65
|
+
*/
|
|
66
|
+
getHostedDomain() {
|
|
67
|
+
return this.wrapped.hostedDomain;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Tells if the User is in the free plan.
|
|
71
|
+
*
|
|
72
|
+
* @returns True if the User is in the free plan
|
|
73
|
+
*/
|
|
74
|
+
isFree() {
|
|
75
|
+
return this.wrapped.free;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Tells if the User has started the trial.
|
|
79
|
+
*
|
|
80
|
+
* @returns True if the User has started the trial
|
|
81
|
+
*/
|
|
82
|
+
hasStartedTrial() {
|
|
83
|
+
return this.wrapped.startedTrial;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Gets the days left in User's trial.
|
|
87
|
+
*
|
|
88
|
+
* @returns The User's days left in trial
|
|
89
|
+
*/
|
|
90
|
+
getDaysLeftInTrial() {
|
|
91
|
+
return this.wrapped.daysLeftInTrial;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Tells if the User has already used [[Connections]].
|
|
95
|
+
*
|
|
96
|
+
* @returns True if the User has already used Connections
|
|
97
|
+
*/
|
|
98
|
+
hasUsedConnections() {
|
|
99
|
+
return this.wrapped.bankConnections;
|
|
100
|
+
}
|
|
47
101
|
/**
|
|
48
102
|
* Gets the [[Connections]] of the User.
|
|
49
103
|
*
|
|
@@ -31,6 +31,12 @@ export function loadBook(bookId) {
|
|
|
31
31
|
return response.data;
|
|
32
32
|
});
|
|
33
33
|
}
|
|
34
|
+
export function createBook(book) {
|
|
35
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
36
|
+
let response = yield new HttpBooksApiV5Request('').setMethod('POST').setPayload(book).fetch();
|
|
37
|
+
return response.data;
|
|
38
|
+
});
|
|
39
|
+
}
|
|
34
40
|
export function updateBook(bookId, book) {
|
|
35
41
|
return __awaiter(this, void 0, void 0, function* () {
|
|
36
42
|
var response = yield new HttpBooksApiV5Request(`${bookId}`).setMethod('PUT').setPayload(book).fetch();
|