bkper-js 1.25.0 → 1.27.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
@@ -367,9 +367,13 @@ export declare class App {
367
367
  */
368
368
  getName(): string | undefined;
369
369
  /**
370
- * @return The type of this App
370
+ * @return True if this App has events bound to it
371
371
  */
372
- getType(): AppType | undefined;
372
+ hasEvents(): boolean;
373
+ /**
374
+ * @return The events bound to this App
375
+ */
376
+ getEvents(): EventType[] | undefined;
373
377
  /**
374
378
  * @return The logo url of this App
375
379
  */
@@ -418,28 +422,6 @@ export declare class App {
418
422
  update(): Promise<App>;
419
423
  }
420
424
 
421
- /**
422
- * Enum that represents the type of an App.
423
- *
424
- * @public
425
- */
426
- export declare enum AppType {
427
- /**
428
- * Interactive solutions that can run independently and integrate with third-party services.
429
- * Apps can range from simple URL openers to complex add-ons with business logic.
430
- *
431
- * Learn more on [Bkper Apps](https://bkper.com/docs/#apps).
432
- */
433
- APP = "APP",
434
- /**
435
- * Specialized type of App that react to events from Books.
436
- * Bots can perform automated tasks like calculating taxes, converting currencies, or posting notifications when specific events occur.
437
- *
438
- * Learn more on [Bkper Bots](https://bkper.com/docs/#bots).
439
- */
440
- BOT = "BOT"
441
- }
442
-
443
425
  /**
444
426
  * The container of balances of an [[Account]] or [[Group]]
445
427
  *
@@ -1462,6 +1444,10 @@ export declare class Event {
1462
1444
  * @returns The Bot Responses associated to this Event
1463
1445
  */
1464
1446
  getBotResponses(): BotResponse[];
1447
+ /**
1448
+ * @returns True if this Event has at least one Bot Response of type ERROR
1449
+ */
1450
+ hasErrorResponse(): boolean;
1465
1451
  }
1466
1452
 
1467
1453
  /**
package/lib/index.js CHANGED
@@ -24,5 +24,5 @@ export { Event } from './model/Event.js';
24
24
  export { BotResponse } from './model/BotResponse.js';
25
25
  export { EventList } from './model/EventList.js';
26
26
  export { User } from './model/User.js';
27
- export { Periodicity, DecimalSeparator, Permission, Visibility, AccountType, Period, Month, EventType, AppType, BotResponseType } from './model/Enums.js';
27
+ export { Periodicity, DecimalSeparator, Permission, Visibility, AccountType, Period, Month, EventType, BotResponseType } from './model/Enums.js';
28
28
  //# sourceMappingURL=index.js.map
package/lib/model/App.js CHANGED
@@ -8,7 +8,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  });
9
9
  };
10
10
  import { createApp, patchApp, updateApp } from "../service/app-service.js";
11
- import { AppType } from "./Enums.js";
12
11
  /**
13
12
  * Defines an App on Bkper.
14
13
  *
@@ -55,11 +54,17 @@ export class App {
55
54
  return this.payload.name;
56
55
  }
57
56
  /**
58
- * @return The type of this App
57
+ * @return True if this App has events bound to it
59
58
  */
60
- getType() {
61
- const events = this.payload.events;
62
- return events && events.length > 0 ? AppType.BOT : AppType.APP;
59
+ hasEvents() {
60
+ const events = this.getEvents() || [];
61
+ return events.length > 0;
62
+ }
63
+ /**
64
+ * @return The events bound to this App
65
+ */
66
+ getEvents() {
67
+ return this.payload.events;
63
68
  }
64
69
  /**
65
70
  * @return The logo url of this App
@@ -148,28 +148,6 @@ export var Month;
148
148
  Month["NOVEMBER"] = "NOVEMBER";
149
149
  Month["DECEMBER"] = "DECEMBER";
150
150
  })(Month || (Month = {}));
151
- /**
152
- * Enum that represents the type of an App.
153
- *
154
- * @public
155
- */
156
- export var AppType;
157
- (function (AppType) {
158
- /**
159
- * Interactive solutions that can run independently and integrate with third-party services.
160
- * Apps can range from simple URL openers to complex add-ons with business logic.
161
- *
162
- * Learn more on [Bkper Apps](https://bkper.com/docs/#apps).
163
- */
164
- AppType["APP"] = "APP";
165
- /**
166
- * Specialized type of App that react to events from Books.
167
- * Bots can perform automated tasks like calculating taxes, converting currencies, or posting notifications when specific events occur.
168
- *
169
- * Learn more on [Bkper Bots](https://bkper.com/docs/#bots).
170
- */
171
- AppType["BOT"] = "BOT";
172
- })(AppType || (AppType = {}));
173
151
  /**
174
152
  * Enum that represents the type of a Bot Response
175
153
  *
@@ -1,5 +1,6 @@
1
1
  import { Agent } from "./Agent.js";
2
2
  import { BotResponse } from "./BotResponse.js";
3
+ import { BotResponseType } from "./Enums.js";
3
4
  import { User } from "./User.js";
4
5
  /**
5
6
  *
@@ -59,5 +60,17 @@ export class Event {
59
60
  this.botResponses = botResponses;
60
61
  return this.botResponses;
61
62
  }
63
+ /**
64
+ * @returns True if this Event has at least one Bot Response of type ERROR
65
+ */
66
+ hasErrorResponse() {
67
+ const botResponses = this.getBotResponses();
68
+ for (const botResponse of botResponses) {
69
+ if (botResponse.getType() === BotResponseType.ERROR) {
70
+ return true;
71
+ }
72
+ }
73
+ return false;
74
+ }
62
75
  }
63
76
  //# sourceMappingURL=Event.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bkper-js",
3
- "version": "1.25.0",
3
+ "version": "1.27.0",
4
4
  "description": "Javascript client for Bkper REST API",
5
5
  "main": "./lib/index.js",
6
6
  "module": "./lib/index.js",