bkper-js 2.29.3 → 2.29.4
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/README.md +11 -8
- package/lib/index.d.ts +4 -0
- package/lib/model/Account.js +4 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -18,11 +18,15 @@ It provides a set of classes and functions to interact with the Bkper API, inclu
|
|
|
18
18
|
```
|
|
19
19
|
npm i -S bkper-js
|
|
20
20
|
```
|
|
21
|
+
|
|
21
22
|
or
|
|
23
|
+
|
|
22
24
|
```
|
|
23
25
|
yarn add bkper-js
|
|
24
26
|
```
|
|
27
|
+
|
|
25
28
|
or
|
|
29
|
+
|
|
26
30
|
```
|
|
27
31
|
bun add bkper-js
|
|
28
32
|
```
|
|
@@ -39,7 +43,7 @@ import { getOAuthToken } from 'bkper';
|
|
|
39
43
|
|
|
40
44
|
// Configure with CLI authentication
|
|
41
45
|
Bkper.setConfig({
|
|
42
|
-
|
|
46
|
+
oauthTokenProvider: async () => getOAuthToken(),
|
|
43
47
|
});
|
|
44
48
|
|
|
45
49
|
// Create Bkper instance
|
|
@@ -54,7 +58,7 @@ const books = await bkper.getBooks();
|
|
|
54
58
|
console.log(`You have ${books.length} books`);
|
|
55
59
|
```
|
|
56
60
|
|
|
57
|
-
First, login via CLI: `bkper login`
|
|
61
|
+
First, login via CLI: `bkper auth login`
|
|
58
62
|
|
|
59
63
|
### Web Applications
|
|
60
64
|
|
|
@@ -66,8 +70,8 @@ import { BkperAuth } from '@bkper/web-auth';
|
|
|
66
70
|
|
|
67
71
|
// Initialize authentication
|
|
68
72
|
const auth = new BkperAuth({
|
|
69
|
-
|
|
70
|
-
|
|
73
|
+
onLoginSuccess: () => initializeApp(),
|
|
74
|
+
onLoginRequired: () => showLoginButton(),
|
|
71
75
|
});
|
|
72
76
|
|
|
73
77
|
// Restore session on app load
|
|
@@ -75,7 +79,7 @@ await auth.init();
|
|
|
75
79
|
|
|
76
80
|
// Configure Bkper with web auth
|
|
77
81
|
Bkper.setConfig({
|
|
78
|
-
|
|
82
|
+
oauthTokenProvider: async () => auth.getAccessToken(),
|
|
79
83
|
});
|
|
80
84
|
|
|
81
85
|
// Create Bkper instance and use it
|
|
@@ -91,8 +95,7 @@ API keys are optional and only needed for dedicated quota limits. If not provide
|
|
|
91
95
|
|
|
92
96
|
```typescript
|
|
93
97
|
Bkper.setConfig({
|
|
94
|
-
|
|
95
|
-
|
|
98
|
+
oauthTokenProvider: async () => getOAuthToken(),
|
|
99
|
+
apiKeyProvider: async () => process.env.BKPER_API_KEY, // Optional - for dedicated quota
|
|
96
100
|
});
|
|
97
101
|
```
|
|
98
|
-
|
package/lib/index.d.ts
CHANGED
|
@@ -13,6 +13,10 @@
|
|
|
13
13
|
*
|
|
14
14
|
* An Account can be grouped by [[Groups]].
|
|
15
15
|
*
|
|
16
|
+
* @remarks
|
|
17
|
+
* `Account` has no `getBalance()` method. To retrieve account balances, use
|
|
18
|
+
* {@link Book.getBalancesReport} and read the resulting {@link BalancesContainer}.
|
|
19
|
+
*
|
|
16
20
|
* @public
|
|
17
21
|
*/
|
|
18
22
|
export declare class Account extends ResourceProperty<bkper.Account> {
|
package/lib/model/Account.js
CHANGED
|
@@ -18,6 +18,10 @@ import { ResourceProperty } from './ResourceProperty.js';
|
|
|
18
18
|
*
|
|
19
19
|
* An Account can be grouped by [[Groups]].
|
|
20
20
|
*
|
|
21
|
+
* @remarks
|
|
22
|
+
* `Account` has no `getBalance()` method. To retrieve account balances, use
|
|
23
|
+
* {@link Book.getBalancesReport} and read the resulting {@link BalancesContainer}.
|
|
24
|
+
*
|
|
21
25
|
* @public
|
|
22
26
|
*/
|
|
23
27
|
export class Account extends ResourceProperty {
|