| 24 | * @module BalancesApi |
| 25 | */ |
| 26 | const balancesAPI = (client) => { |
| 27 | return { |
| 28 | /** |
| 29 | * Get one page of balances matching the specified query. |
| 30 | * |
| 31 | * @param {Object} params={} - Filter and pagination information. |
| 32 | * @param {String} params.filter - Filter string, see {@link https://chain.com/docs/core/build-applications/queries}. |
| 33 | * @param {Array<String|Number>} params.filterParams - Parameter values for filter string (if needed). |
| 34 | * @param {Array<String>} params.sumBy - List of unspent output attributes to sum by. |
| 35 | * @param {Integer} params.timestamp - A millisecond Unix timestamp. By using this parameter, you can perform queries that reflect the state of the blockchain at different points in time. |
| 36 | * @param {Number} params.pageSize - Number of items to return in result set. |
| 37 | * @param {pageCallback} [callback] - Optional callback. Use instead of Promise return value as desired. |
| 38 | * @returns {Promise<Page<Balance>>} Requested page of results. |
| 39 | */ |
| 40 | query: (params, cb) => shared.query(client, 'balances', '/list-balances', params, {cb}), |
| 41 | |
| 42 | /** |
| 43 | * Request all balances matching the specified query, calling the |
| 44 | * supplied processor callback with each item individually. |
| 45 | * |
| 46 | * @param {Object} params={} - Filter and pagination information. |
| 47 | * @param {String} params.filter - Filter string, see {@link https://chain.com/docs/core/build-applications/queries}. |
| 48 | * @param {Array<String|Number>} params.filterParams - Parameter values for filter string (if needed). |
| 49 | * @param {Array<String>} params.sumBy - List of unspent output attributes to sum by. |
| 50 | * @param {Integer} params.timestamp - A millisecond Unix timestamp. By using this parameter, you can perform queries that reflect the state of the blockchain at different points in time. |
| 51 | * @param {Number} params.pageSize - Number of items to return in result set. |
| 52 | * @param {QueryProcessor<Balance>} processor - Processing callback. |
| 53 | * @param {objectCallback} [callback] - Optional callback. Use instead of Promise return value as desired. |
| 54 | * @returns {Promise} A promise resolved upon processing of all items, or |
| 55 | * rejected on error. |
| 56 | */ |
| 57 | queryAll: (params, processor, cb) => shared.queryAll(client, 'balances', params, processor, cb), |
| 58 | } |
| 59 | } |
| 60 | |
| 61 | module.exports = balancesAPI |