bkper-js 2.13.0 → 2.14.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 +8 -0
- package/lib/model/Book.js +13 -0
- package/lib/service/transaction-service.js +7 -0
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -1850,6 +1850,14 @@ export declare class Book extends Resource<bkper.Book> {
|
|
|
1850
1850
|
* @returns A [[TransactionList]] object containing the list of transactions
|
|
1851
1851
|
*/
|
|
1852
1852
|
listTransactions(query?: string, limit?: number, cursor?: string): Promise<TransactionList>;
|
|
1853
|
+
/**
|
|
1854
|
+
* Retrieve the number of transactions based on a query.
|
|
1855
|
+
*
|
|
1856
|
+
* @param query - The query string
|
|
1857
|
+
*
|
|
1858
|
+
* @returns The number of matching transactions
|
|
1859
|
+
*/
|
|
1860
|
+
countTransactions(query?: string): Promise<number | undefined>;
|
|
1853
1861
|
/**
|
|
1854
1862
|
* Lists events in the Book based on the provided parameters.
|
|
1855
1863
|
*
|
package/lib/model/Book.js
CHANGED
|
@@ -1070,6 +1070,19 @@ export class Book extends Resource {
|
|
|
1070
1070
|
return new TransactionList(this, transactionsList);
|
|
1071
1071
|
});
|
|
1072
1072
|
}
|
|
1073
|
+
/**
|
|
1074
|
+
* Retrieve the number of transactions based on a query.
|
|
1075
|
+
*
|
|
1076
|
+
* @param query - The query string
|
|
1077
|
+
*
|
|
1078
|
+
* @returns The number of matching transactions
|
|
1079
|
+
*/
|
|
1080
|
+
countTransactions(query) {
|
|
1081
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1082
|
+
const count = yield TransactionService.countTransactions(this.getId(), query, this.getConfig());
|
|
1083
|
+
return count.total;
|
|
1084
|
+
});
|
|
1085
|
+
}
|
|
1073
1086
|
/**
|
|
1074
1087
|
* Lists events in the Book based on the provided parameters.
|
|
1075
1088
|
*
|
|
@@ -126,4 +126,11 @@ export function listTransactions(bookId, query, limit, cursor, config) {
|
|
|
126
126
|
return response.data;
|
|
127
127
|
});
|
|
128
128
|
}
|
|
129
|
+
export function countTransactions(bookId, query, config) {
|
|
130
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
131
|
+
const request = new HttpBooksApiV5Request(`${bookId}/transactions/count`, config).setMethod('GET').addParam('query', query);
|
|
132
|
+
const response = yield request.fetch();
|
|
133
|
+
return response.data;
|
|
134
|
+
});
|
|
135
|
+
}
|
|
129
136
|
//# sourceMappingURL=transaction-service.js.map
|