bkper-js 2.7.1 → 2.8.1

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.
Files changed (38) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/lib/index.d.ts +172 -99
  3. package/lib/model/Account.js +20 -21
  4. package/lib/model/App.js +72 -21
  5. package/lib/model/Bkper.js +42 -30
  6. package/lib/model/Book.js +109 -99
  7. package/lib/model/BotResponse.js +2 -2
  8. package/lib/model/Collaborator.js +12 -11
  9. package/lib/model/Collection.js +24 -19
  10. package/lib/model/Connection.js +28 -18
  11. package/lib/model/Conversation.js +20 -13
  12. package/lib/model/File.js +19 -17
  13. package/lib/model/Group.js +29 -21
  14. package/lib/model/Integration.js +17 -13
  15. package/lib/model/Message.js +20 -16
  16. package/lib/model/Query.js +12 -11
  17. package/lib/model/Resource.js +23 -0
  18. package/lib/model/Template.js +10 -7
  19. package/lib/model/Transaction.js +61 -43
  20. package/lib/model/User.js +14 -12
  21. package/lib/service/account-service.js +12 -12
  22. package/lib/service/app-service.js +8 -8
  23. package/lib/service/balances-service.js +2 -2
  24. package/lib/service/book-service.js +14 -14
  25. package/lib/service/collaborator-service.js +6 -6
  26. package/lib/service/collection-service.js +12 -12
  27. package/lib/service/connection-service.js +12 -15
  28. package/lib/service/conversation-service.js +10 -10
  29. package/lib/service/event-service.js +8 -8
  30. package/lib/service/file-service.js +4 -4
  31. package/lib/service/group-service.js +16 -16
  32. package/lib/service/http-api-request.js +54 -45
  33. package/lib/service/integration-service.js +8 -8
  34. package/lib/service/query-service.js +8 -8
  35. package/lib/service/template-service.js +2 -2
  36. package/lib/service/transaction-service.js +32 -32
  37. package/lib/service/user-service.js +4 -4
  38. package/package.json +1 -1
@@ -8,28 +8,28 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  });
9
9
  };
10
10
  import { HttpBooksApiV5Request } from "./http-api-request.js";
11
- export function getSavedQueries(bookId) {
11
+ export function getSavedQueries(bookId, config) {
12
12
  return __awaiter(this, void 0, void 0, function* () {
13
13
  var _a;
14
- let response = yield new HttpBooksApiV5Request(`${bookId}/queries`).setMethod('GET').fetch();
14
+ let response = yield new HttpBooksApiV5Request(`${bookId}/queries`, config).setMethod('GET').fetch();
15
15
  return ((_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.items) || [];
16
16
  });
17
17
  }
18
- export function createSavedQuery(bookId, query) {
18
+ export function createSavedQuery(bookId, query, config) {
19
19
  return __awaiter(this, void 0, void 0, function* () {
20
- let response = yield new HttpBooksApiV5Request(`${bookId}/queries`).setMethod('POST').setPayload(query).fetch();
20
+ let response = yield new HttpBooksApiV5Request(`${bookId}/queries`, config).setMethod('POST').setPayload(query).fetch();
21
21
  return response.data;
22
22
  });
23
23
  }
24
- export function updateSavedQuery(bookId, query) {
24
+ export function updateSavedQuery(bookId, query, config) {
25
25
  return __awaiter(this, void 0, void 0, function* () {
26
- let response = yield new HttpBooksApiV5Request(`${bookId}/queries`).setMethod('PUT').setPayload(query).fetch();
26
+ let response = yield new HttpBooksApiV5Request(`${bookId}/queries`, config).setMethod('PUT').setPayload(query).fetch();
27
27
  return response.data;
28
28
  });
29
29
  }
30
- export function deleteSavedQuery(bookId, queryId) {
30
+ export function deleteSavedQuery(bookId, queryId, config) {
31
31
  return __awaiter(this, void 0, void 0, function* () {
32
- let response = yield new HttpBooksApiV5Request(`${bookId}/queries/${queryId}`).setMethod('DELETE').fetch();
32
+ let response = yield new HttpBooksApiV5Request(`${bookId}/queries/${queryId}`, config).setMethod('DELETE').fetch();
33
33
  return response.data;
34
34
  });
35
35
  }
@@ -8,9 +8,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  });
9
9
  };
10
10
  import { HttpApiRequest } from "./http-api-request.js";
11
- export function getTemplates() {
11
+ export function getTemplates(config) {
12
12
  return __awaiter(this, void 0, void 0, function* () {
13
- let response = yield new HttpApiRequest(`v5/templates`).setMethod('GET').fetch();
13
+ let response = yield new HttpApiRequest(`v5/templates`, config).setMethod('GET').fetch();
14
14
  if (response.data == null) {
15
15
  return [];
16
16
  }
@@ -8,107 +8,107 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  });
9
9
  };
10
10
  import { HttpBooksApiV5Request } from "./http-api-request.js";
11
- export function createTransaction(bookId, transaction) {
11
+ export function createTransaction(bookId, transaction, config) {
12
12
  return __awaiter(this, void 0, void 0, function* () {
13
- var response = yield new HttpBooksApiV5Request(`${bookId}/transactions`).setMethod('POST').setPayload(transaction).fetch();
13
+ var response = yield new HttpBooksApiV5Request(`${bookId}/transactions`, config).setMethod('POST').setPayload(transaction).fetch();
14
14
  return response.data;
15
15
  });
16
16
  }
17
- export function postTransactionsBatch(bookId, transactions) {
17
+ export function postTransactionsBatch(bookId, transactions, config) {
18
18
  return __awaiter(this, void 0, void 0, function* () {
19
19
  const payload = { items: transactions };
20
- yield new HttpBooksApiV5Request(`${bookId}/transactions/post/batch`).setMethod('PATCH').setPayload(payload).fetch();
20
+ yield new HttpBooksApiV5Request(`${bookId}/transactions/post/batch`, config).setMethod('PATCH').setPayload(payload).fetch();
21
21
  });
22
22
  }
23
- export function createTransactionsBatch(bookId, transactions) {
23
+ export function createTransactionsBatch(bookId, transactions, config) {
24
24
  return __awaiter(this, void 0, void 0, function* () {
25
25
  let transactionList = { items: transactions };
26
26
  const payload = transactionList;
27
- const response = yield new HttpBooksApiV5Request(`${bookId}/transactions/batch`).setMethod('POST').setPayload(payload).fetch();
27
+ const response = yield new HttpBooksApiV5Request(`${bookId}/transactions/batch`, config).setMethod('POST').setPayload(payload).fetch();
28
28
  transactionList = yield response.data;
29
29
  return transactionList != null && transactionList.items != null ? transactionList.items : [];
30
30
  });
31
31
  }
32
- export function updateTransactionsBatch(bookId, transactions, updateChecked) {
32
+ export function updateTransactionsBatch(bookId, transactions, updateChecked, config) {
33
33
  return __awaiter(this, void 0, void 0, function* () {
34
34
  let transactionList = { items: transactions };
35
35
  const payload = transactionList;
36
- const response = yield new HttpBooksApiV5Request(`${bookId}/transactions/batch`).setMethod('PUT').setPayload(payload).addParam('updateChecked', updateChecked).fetch();
36
+ const response = yield new HttpBooksApiV5Request(`${bookId}/transactions/batch`, config).setMethod('PUT').setPayload(payload).addParam('updateChecked', updateChecked).fetch();
37
37
  transactionList = yield response.data;
38
38
  return transactionList != null && transactionList.items != null ? transactionList.items : [];
39
39
  });
40
40
  }
41
- export function checkTransactionsBatch(bookId, transactions) {
41
+ export function checkTransactionsBatch(bookId, transactions, config) {
42
42
  return __awaiter(this, void 0, void 0, function* () {
43
43
  const payload = { items: transactions };
44
- yield new HttpBooksApiV5Request(`${bookId}/transactions/check/batch`).setMethod('PATCH').setPayload(payload).fetch();
44
+ yield new HttpBooksApiV5Request(`${bookId}/transactions/check/batch`, config).setMethod('PATCH').setPayload(payload).fetch();
45
45
  });
46
46
  }
47
- export function uncheckTransactionsBatch(bookId, transactions) {
47
+ export function uncheckTransactionsBatch(bookId, transactions, config) {
48
48
  return __awaiter(this, void 0, void 0, function* () {
49
49
  const payload = { items: transactions };
50
- yield new HttpBooksApiV5Request(`${bookId}/transactions/uncheck/batch`).setMethod('PATCH').setPayload(payload).fetch();
50
+ yield new HttpBooksApiV5Request(`${bookId}/transactions/uncheck/batch`, config).setMethod('PATCH').setPayload(payload).fetch();
51
51
  });
52
52
  }
53
- export function trashTransactionsBatch(bookId, transactions, trashChecked) {
53
+ export function trashTransactionsBatch(bookId, transactions, trashChecked, config) {
54
54
  return __awaiter(this, void 0, void 0, function* () {
55
55
  let transactionList = { items: transactions };
56
56
  const payload = transactionList;
57
- const response = yield new HttpBooksApiV5Request(`${bookId}/transactions/trash/batch`).setMethod('PATCH').setPayload(payload).addParam('trashChecked', trashChecked).fetch();
57
+ const response = yield new HttpBooksApiV5Request(`${bookId}/transactions/trash/batch`, config).setMethod('PATCH').setPayload(payload).addParam('trashChecked', trashChecked).fetch();
58
58
  transactionList = yield response.data;
59
59
  });
60
60
  }
61
- export function untrashTransactionsBatch(bookId, transactions) {
61
+ export function untrashTransactionsBatch(bookId, transactions, config) {
62
62
  return __awaiter(this, void 0, void 0, function* () {
63
63
  let transactionList = { items: transactions };
64
64
  const payload = transactionList;
65
- const response = yield new HttpBooksApiV5Request(`${bookId}/transactions/untrash/batch`).setMethod('PATCH').setPayload(payload).fetch();
65
+ const response = yield new HttpBooksApiV5Request(`${bookId}/transactions/untrash/batch`, config).setMethod('PATCH').setPayload(payload).fetch();
66
66
  transactionList = yield response.data;
67
67
  });
68
68
  }
69
- export function updateTransaction(bookId, transaction) {
69
+ export function updateTransaction(bookId, transaction, config) {
70
70
  return __awaiter(this, void 0, void 0, function* () {
71
- var response = yield new HttpBooksApiV5Request(`${bookId}/transactions`).setMethod('PUT').setPayload(transaction).fetch();
71
+ var response = yield new HttpBooksApiV5Request(`${bookId}/transactions`, config).setMethod('PUT').setPayload(transaction).fetch();
72
72
  return response.data;
73
73
  });
74
74
  }
75
- export function postTransaction(bookId, transaction) {
75
+ export function postTransaction(bookId, transaction, config) {
76
76
  return __awaiter(this, void 0, void 0, function* () {
77
- var response = yield new HttpBooksApiV5Request(`${bookId}/transactions/post`).setMethod('PATCH').setPayload(transaction).fetch();
77
+ var response = yield new HttpBooksApiV5Request(`${bookId}/transactions/post`, config).setMethod('PATCH').setPayload(transaction).fetch();
78
78
  return response.data;
79
79
  });
80
80
  }
81
- export function checkTransaction(bookId, transaction) {
81
+ export function checkTransaction(bookId, transaction, config) {
82
82
  return __awaiter(this, void 0, void 0, function* () {
83
- var response = yield new HttpBooksApiV5Request(`${bookId}/transactions/check`).setMethod('PATCH').setPayload(transaction).fetch();
83
+ var response = yield new HttpBooksApiV5Request(`${bookId}/transactions/check`, config).setMethod('PATCH').setPayload(transaction).fetch();
84
84
  return response.data;
85
85
  });
86
86
  }
87
- export function uncheckTransaction(bookId, transaction) {
87
+ export function uncheckTransaction(bookId, transaction, config) {
88
88
  return __awaiter(this, void 0, void 0, function* () {
89
- var response = yield new HttpBooksApiV5Request(`${bookId}/transactions/uncheck`).setMethod('PATCH').setPayload(transaction).fetch();
89
+ var response = yield new HttpBooksApiV5Request(`${bookId}/transactions/uncheck`, config).setMethod('PATCH').setPayload(transaction).fetch();
90
90
  return response.data;
91
91
  });
92
92
  }
93
- export function trashTransaction(bookId, transaction) {
93
+ export function trashTransaction(bookId, transaction, config) {
94
94
  return __awaiter(this, void 0, void 0, function* () {
95
- var response = yield new HttpBooksApiV5Request(`${bookId}/transactions/trash`).setMethod('PATCH').setPayload(transaction).fetch();
95
+ var response = yield new HttpBooksApiV5Request(`${bookId}/transactions/trash`, config).setMethod('PATCH').setPayload(transaction).fetch();
96
96
  return response.data;
97
97
  });
98
98
  }
99
- export function restoreTransaction(bookId, transaction) {
99
+ export function restoreTransaction(bookId, transaction, config) {
100
100
  return __awaiter(this, void 0, void 0, function* () {
101
- var response = yield new HttpBooksApiV5Request(`${bookId}/transactions/restore`).setMethod('PATCH').setPayload(transaction).fetch();
101
+ var response = yield new HttpBooksApiV5Request(`${bookId}/transactions/restore`, config).setMethod('PATCH').setPayload(transaction).fetch();
102
102
  return response.data;
103
103
  });
104
104
  }
105
- export function getTransaction(bookId, id) {
105
+ export function getTransaction(bookId, id, config) {
106
106
  return __awaiter(this, void 0, void 0, function* () {
107
- var response = yield new HttpBooksApiV5Request(`${bookId}/transactions/${id}`).setMethod('GET').fetch();
107
+ var response = yield new HttpBooksApiV5Request(`${bookId}/transactions/${id}`, config).setMethod('GET').fetch();
108
108
  return response.data;
109
109
  });
110
110
  }
111
- export function listTransactions(bookId, query, limit, cursor) {
111
+ export function listTransactions(bookId, query, limit, cursor, config) {
112
112
  return __awaiter(this, void 0, void 0, function* () {
113
113
  if (!query) {
114
114
  query = "";
@@ -116,7 +116,7 @@ export function listTransactions(bookId, query, limit, cursor) {
116
116
  if (!limit) {
117
117
  limit = 100;
118
118
  }
119
- var request = new HttpBooksApiV5Request(`${bookId}/transactions`);
119
+ var request = new HttpBooksApiV5Request(`${bookId}/transactions`, config);
120
120
  request.addParam('query', query);
121
121
  request.addParam('limit', limit);
122
122
  if (cursor != null) {
@@ -8,15 +8,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  });
9
9
  };
10
10
  import { HttpApiV5Request } from "./http-api-request.js";
11
- export function getUser() {
11
+ export function getUser(config) {
12
12
  return __awaiter(this, void 0, void 0, function* () {
13
- const res = yield new HttpApiV5Request(`user`).setMethod('GET').fetch();
13
+ const res = yield new HttpApiV5Request(`user`, config).setMethod('GET').fetch();
14
14
  return res.data;
15
15
  });
16
16
  }
17
- export function getBillingPortalUrl(returnUrl) {
17
+ export function getBillingPortalUrl(returnUrl, config) {
18
18
  return __awaiter(this, void 0, void 0, function* () {
19
- const res = yield new HttpApiV5Request(`user/billing/portal`).addParam('returnUrl', returnUrl).fetch();
19
+ const res = yield new HttpApiV5Request(`user/billing/portal`, config).addParam('returnUrl', returnUrl).fetch();
20
20
  return res.data;
21
21
  });
22
22
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bkper-js",
3
- "version": "2.7.1",
3
+ "version": "2.8.1",
4
4
  "description": "Javascript client for Bkper REST API",
5
5
  "main": "./lib/index.js",
6
6
  "module": "./lib/index.js",