bkper-js 1.20.0 → 1.22.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 CHANGED
@@ -220,6 +220,37 @@ export declare enum AccountType {
220
220
  OUTGOING = "OUTGOING"
221
221
  }
222
222
 
223
+ /**
224
+ * Defines an Agent on Bkper.
225
+ *
226
+ * An Agent represents an entity (such as an App or Bot) that interacts with Bkper, executing actions on behalf of users.
227
+ *
228
+ * @public
229
+ */
230
+ export declare class Agent {
231
+ payload: bkper.Agent;
232
+ constructor(payload?: bkper.Agent);
233
+ /**
234
+ * @returns The wrapped plain json object
235
+ */
236
+ json(): bkper.Agent;
237
+ /**
238
+ *
239
+ * @returns The Agent universal identifier
240
+ */
241
+ getId(): string | undefined;
242
+ /**
243
+ *
244
+ * @returns The Agent name
245
+ */
246
+ getName(): string | undefined;
247
+ /**
248
+ *
249
+ * @returns The Agent logo url
250
+ */
251
+ getLogoUrl(): string | undefined;
252
+ }
253
+
223
254
  /**
224
255
  * This class defines an Amount for arbitrary-precision decimal arithmetic.
225
256
  *
@@ -545,19 +576,6 @@ export declare class BalancesReport {
545
576
  * @public
546
577
  */
547
578
  export declare class Bkper {
548
- /**
549
- * Instantiate a new [[Book]]
550
- *
551
- * Example:
552
- * ```js
553
- * var book = Bkper.newBook()
554
- * .setName('My New Book')
555
- * .setFractionDigits(2)
556
- * .setDecimalSeparator('DOT')
557
- * .create();
558
- * ```
559
- */
560
- static newBook(): Book;
561
579
  /**
562
580
  * Gets the [[Book]] with the specified bookId from url param.
563
581
  *
@@ -778,6 +796,17 @@ export declare class Book {
778
796
  * @returns The time zone offset of the book, in minutes
779
797
  */
780
798
  getTimeZoneOffset(): number | undefined;
799
+ /**
800
+ * @returns The auto post status of the Book
801
+ */
802
+ getAutoPost(): boolean | undefined;
803
+ /**
804
+ *
805
+ * Sets the auto post status of the Book
806
+ *
807
+ * @returns This Book, for chainning.
808
+ */
809
+ setAutoPost(autoPost: boolean): Book;
781
810
  /**
782
811
  * @returns The last update date of the book, in in milliseconds
783
812
  */
@@ -1306,7 +1335,10 @@ export declare enum DecimalSeparator {
1306
1335
  }
1307
1336
 
1308
1337
  /**
1309
- * Represents an Event in the system.
1338
+ *
1339
+ * This class defines an Event from a [[Book]].
1340
+ *
1341
+ * An event is an object that represents an action (such as posting or deleting a [[Transaction]]) made by an actor (such as a user or a [Bot](https://bkper.com/apps) acting on behalf of a user).
1310
1342
  *
1311
1343
  * @public
1312
1344
  */
@@ -1317,6 +1349,22 @@ export declare class Event {
1317
1349
  * @returns The wrapped plain json object
1318
1350
  */
1319
1351
  json(): bkper.Event;
1352
+ /**
1353
+ * @returns The user who performed the event
1354
+ */
1355
+ getUser(): User | undefined;
1356
+ /**
1357
+ * @returns The user who performed the event
1358
+ */
1359
+ getAgent(): Agent | undefined;
1360
+ /**
1361
+ * @returns The date the event was created
1362
+ */
1363
+ getCreatedAt(): Date | undefined;
1364
+ /**
1365
+ * @returns The type of the event
1366
+ */
1367
+ getType(): EventType | undefined;
1320
1368
  }
1321
1369
 
1322
1370
  /**
@@ -1349,6 +1397,41 @@ export declare class EventList {
1349
1397
  getItems(): Event[];
1350
1398
  }
1351
1399
 
1400
+ /**
1401
+ * Enum that represents event types.
1402
+ *
1403
+ * @public
1404
+ */
1405
+ export declare enum EventType {
1406
+ FILE_CREATED = "FILE_CREATED",
1407
+ TRANSACTION_CREATED = "TRANSACTION_CREATED",
1408
+ TRANSACTION_UPDATED = "TRANSACTION_UPDATED",
1409
+ TRANSACTION_DELETED = "TRANSACTION_DELETED",
1410
+ TRANSACTION_POSTED = "TRANSACTION_POSTED",
1411
+ TRANSACTION_CHECKED = "TRANSACTION_CHECKED",
1412
+ TRANSACTION_UNCHECKED = "TRANSACTION_UNCHECKED",
1413
+ TRANSACTION_RESTORED = "TRANSACTION_RESTORED",
1414
+ ACCOUNT_CREATED = "ACCOUNT_CREATED",
1415
+ ACCOUNT_UPDATED = "ACCOUNT_UPDATED",
1416
+ ACCOUNT_DELETED = "ACCOUNT_DELETED",
1417
+ QUERY_CREATED = "QUERY_CREATED",
1418
+ QUERY_UPDATED = "QUERY_UPDATED",
1419
+ QUERY_DELETED = "QUERY_DELETED",
1420
+ GROUP_CREATED = "GROUP_CREATED",
1421
+ GROUP_UPDATED = "GROUP_UPDATED",
1422
+ GROUP_DELETED = "GROUP_DELETED",
1423
+ COMMENT_CREATED = "COMMENT_CREATED",
1424
+ COMMENT_DELETED = "COMMENT_DELETED",
1425
+ COLLABORATOR_ADDED = "COLLABORATOR_ADDED",
1426
+ COLLABORATOR_UPDATED = "COLLABORATOR_UPDATED",
1427
+ COLLABORATOR_REMOVED = "COLLABORATOR_REMOVED",
1428
+ INTEGRATION_CREATED = "INTEGRATION_CREATED",
1429
+ INTEGRATION_UPDATED = "INTEGRATION_UPDATED",
1430
+ INTEGRATION_DELETED = "INTEGRATION_DELETED",
1431
+ BOOK_UPDATED = "BOOK_UPDATED",
1432
+ BOOK_DELETED = "BOOK_DELETED"
1433
+ }
1434
+
1352
1435
  /**
1353
1436
  *
1354
1437
  * This class defines a File uploaded to a [[Book]].
@@ -2287,6 +2370,12 @@ export declare class User {
2287
2370
  * @returns The User's name
2288
2371
  */
2289
2372
  getName(): string | undefined;
2373
+ /**
2374
+ * Gets the avatar url of the User.
2375
+ *
2376
+ * @returns The User's avatar url
2377
+ */
2378
+ getAvatarUrl(): string | undefined;
2290
2379
  /**
2291
2380
  * Gets the full name of the User.
2292
2381
  *
@@ -2311,6 +2400,12 @@ export declare class User {
2311
2400
  * @returns True if the User is in the free plan
2312
2401
  */
2313
2402
  isFree(): boolean | undefined;
2403
+ /**
2404
+ * Gets the plan of the User.
2405
+ *
2406
+ * @returns The User's plan
2407
+ */
2408
+ getPlan(): string | undefined;
2314
2409
  /**
2315
2410
  * Tells if billing is enabled for the User.
2316
2411
  *
package/lib/index.js CHANGED
@@ -6,6 +6,7 @@
6
6
  * @packageDocumentation
7
7
  */
8
8
  export { Account } from './model/Account.js';
9
+ export { Agent } from './model/Agent.js';
9
10
  export { Amount } from "./model/Amount.js";
10
11
  export { App } from './model/App.js';
11
12
  export { BalancesReport } from './model/BalancesReport.js';
@@ -22,5 +23,5 @@ export { TransactionList } from './model/TransactionList.js';
22
23
  export { Event } from './model/Event.js';
23
24
  export { EventList } from './model/EventList.js';
24
25
  export { User } from './model/User.js';
25
- export { Periodicity, DecimalSeparator, Permission, Visibility, AccountType, Period, Month } from './model/Enums.js';
26
+ export { Periodicity, DecimalSeparator, Permission, Visibility, AccountType, Period, Month, EventType } from './model/Enums.js';
26
27
  //# sourceMappingURL=index.js.map
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Defines an Agent on Bkper.
3
+ *
4
+ * An Agent represents an entity (such as an App or Bot) that interacts with Bkper, executing actions on behalf of users.
5
+ *
6
+ * @public
7
+ */
8
+ export class Agent {
9
+ constructor(payload) {
10
+ this.payload = payload || {};
11
+ }
12
+ /**
13
+ * @returns The wrapped plain json object
14
+ */
15
+ json() {
16
+ return Object.assign({}, this.payload);
17
+ }
18
+ /**
19
+ *
20
+ * @returns The Agent universal identifier
21
+ */
22
+ getId() {
23
+ return this.payload.id;
24
+ }
25
+ /**
26
+ *
27
+ * @returns The Agent name
28
+ */
29
+ getName() {
30
+ return this.payload.name;
31
+ }
32
+ /**
33
+ *
34
+ * @returns The Agent logo url
35
+ */
36
+ getLogoUrl() {
37
+ return this.payload.logo;
38
+ }
39
+ }
40
+ //# sourceMappingURL=Agent.js.map
@@ -37,21 +37,6 @@ import { Collection } from "./Collection.js";
37
37
  * @public
38
38
  */
39
39
  export class Bkper {
40
- /**
41
- * Instantiate a new [[Book]]
42
- *
43
- * Example:
44
- * ```js
45
- * var book = Bkper.newBook()
46
- * .setName('My New Book')
47
- * .setFractionDigits(2)
48
- * .setDecimalSeparator('DOT')
49
- * .create();
50
- * ```
51
- */
52
- static newBook() {
53
- return new Book();
54
- }
55
40
  /**
56
41
  * Gets the [[Book]] with the specified bookId from url param.
57
42
  *
package/lib/model/Book.js CHANGED
@@ -252,6 +252,22 @@ export class Book {
252
252
  getTimeZoneOffset() {
253
253
  return this.payload.timeZoneOffset;
254
254
  }
255
+ /**
256
+ * @returns The auto post status of the Book
257
+ */
258
+ getAutoPost() {
259
+ return this.payload.autoPost;
260
+ }
261
+ /**
262
+ *
263
+ * Sets the auto post status of the Book
264
+ *
265
+ * @returns This Book, for chainning.
266
+ */
267
+ setAutoPost(autoPost) {
268
+ this.payload.autoPost = autoPost;
269
+ return this;
270
+ }
255
271
  /**
256
272
  * @returns The last update date of the book, in in milliseconds
257
273
  */
@@ -148,4 +148,39 @@ export var Month;
148
148
  Month["NOVEMBER"] = "NOVEMBER";
149
149
  Month["DECEMBER"] = "DECEMBER";
150
150
  })(Month || (Month = {}));
151
+ /**
152
+ * Enum that represents event types.
153
+ *
154
+ * @public
155
+ */
156
+ export var EventType;
157
+ (function (EventType) {
158
+ EventType["FILE_CREATED"] = "FILE_CREATED";
159
+ EventType["TRANSACTION_CREATED"] = "TRANSACTION_CREATED";
160
+ EventType["TRANSACTION_UPDATED"] = "TRANSACTION_UPDATED";
161
+ EventType["TRANSACTION_DELETED"] = "TRANSACTION_DELETED";
162
+ EventType["TRANSACTION_POSTED"] = "TRANSACTION_POSTED";
163
+ EventType["TRANSACTION_CHECKED"] = "TRANSACTION_CHECKED";
164
+ EventType["TRANSACTION_UNCHECKED"] = "TRANSACTION_UNCHECKED";
165
+ EventType["TRANSACTION_RESTORED"] = "TRANSACTION_RESTORED";
166
+ EventType["ACCOUNT_CREATED"] = "ACCOUNT_CREATED";
167
+ EventType["ACCOUNT_UPDATED"] = "ACCOUNT_UPDATED";
168
+ EventType["ACCOUNT_DELETED"] = "ACCOUNT_DELETED";
169
+ EventType["QUERY_CREATED"] = "QUERY_CREATED";
170
+ EventType["QUERY_UPDATED"] = "QUERY_UPDATED";
171
+ EventType["QUERY_DELETED"] = "QUERY_DELETED";
172
+ EventType["GROUP_CREATED"] = "GROUP_CREATED";
173
+ EventType["GROUP_UPDATED"] = "GROUP_UPDATED";
174
+ EventType["GROUP_DELETED"] = "GROUP_DELETED";
175
+ EventType["COMMENT_CREATED"] = "COMMENT_CREATED";
176
+ EventType["COMMENT_DELETED"] = "COMMENT_DELETED";
177
+ EventType["COLLABORATOR_ADDED"] = "COLLABORATOR_ADDED";
178
+ EventType["COLLABORATOR_UPDATED"] = "COLLABORATOR_UPDATED";
179
+ EventType["COLLABORATOR_REMOVED"] = "COLLABORATOR_REMOVED";
180
+ EventType["INTEGRATION_CREATED"] = "INTEGRATION_CREATED";
181
+ EventType["INTEGRATION_UPDATED"] = "INTEGRATION_UPDATED";
182
+ EventType["INTEGRATION_DELETED"] = "INTEGRATION_DELETED";
183
+ EventType["BOOK_UPDATED"] = "BOOK_UPDATED";
184
+ EventType["BOOK_DELETED"] = "BOOK_DELETED";
185
+ })(EventType || (EventType = {}));
151
186
  //# sourceMappingURL=Enums.js.map
@@ -1,5 +1,10 @@
1
+ import { Agent } from "./Agent";
2
+ import { User } from "./User";
1
3
  /**
2
- * Represents an Event in the system.
4
+ *
5
+ * This class defines an Event from a [[Book]].
6
+ *
7
+ * An event is an object that represents an action (such as posting or deleting a [[Transaction]]) made by an actor (such as a user or a [Bot](https://bkper.com/apps) acting on behalf of a user).
3
8
  *
4
9
  * @public
5
10
  */
@@ -13,5 +18,29 @@ export class Event {
13
18
  json() {
14
19
  return Object.assign({}, this.payload);
15
20
  }
21
+ /**
22
+ * @returns The user who performed the event
23
+ */
24
+ getUser() {
25
+ return this.payload.user ? new User(this.payload.user) : undefined;
26
+ }
27
+ /**
28
+ * @returns The user who performed the event
29
+ */
30
+ getAgent() {
31
+ return this.payload.agent ? new Agent(this.payload.agent) : undefined;
32
+ }
33
+ /**
34
+ * @returns The date the event was created
35
+ */
36
+ getCreatedAt() {
37
+ return this.payload.createdAt ? new Date(new Number(this.payload.createdAt).valueOf()) : undefined;
38
+ }
39
+ /**
40
+ * @returns The type of the event
41
+ */
42
+ getType() {
43
+ return this.payload.type;
44
+ }
16
45
  }
17
46
  //# sourceMappingURL=Event.js.map
package/lib/model/User.js CHANGED
@@ -41,6 +41,14 @@ export class User {
41
41
  getName() {
42
42
  return this.payload.name;
43
43
  }
44
+ /**
45
+ * Gets the avatar url of the User.
46
+ *
47
+ * @returns The User's avatar url
48
+ */
49
+ getAvatarUrl() {
50
+ return this.payload.avatarUrl;
51
+ }
44
52
  /**
45
53
  * Gets the full name of the User.
46
54
  *
@@ -73,6 +81,14 @@ export class User {
73
81
  isFree() {
74
82
  return this.payload.free;
75
83
  }
84
+ /**
85
+ * Gets the plan of the User.
86
+ *
87
+ * @returns The User's plan
88
+ */
89
+ getPlan() {
90
+ return this.payload.plan;
91
+ }
76
92
  /**
77
93
  * Tells if billing is enabled for the User.
78
94
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bkper-js",
3
- "version": "1.20.0",
3
+ "version": "1.22.0",
4
4
  "description": "Javascript client for Bkper REST API",
5
5
  "main": "./lib/index.js",
6
6
  "module": "./lib/index.js",
@@ -34,7 +34,7 @@
34
34
  "postversion": "git push --tags && yarn publish --new-version $npm_package_version && git push && echo \"Successfully released version $npm_package_version!\""
35
35
  },
36
36
  "peerDependencies": {
37
- "@bkper/bkper-api-types": "^5.10.0"
37
+ "@bkper/bkper-api-types": "^5.12.0"
38
38
  },
39
39
  "dependencies": {
40
40
  "@google-cloud/local-auth": "^3.0.1",