(client)
| 184 | * @module TransactionFeedsApi |
| 185 | */ |
| 186 | const transactionFeedsAPI = (client) => { |
| 187 | return { |
| 188 | /** |
| 189 | * Create a new transaction feed. |
| 190 | * |
| 191 | * @param {Object} params - Parameters for creating Transaction Feeds. |
| 192 | * @param {String} params.alias - A unique alias for the transaction feed. |
| 193 | * @param {String} params.filter - A valid filter string for the `/list-transactions` |
| 194 | * endpoint. The transaction feed will be composed of future |
| 195 | * transactions that match the filter. |
| 196 | * @param {objectCallback} [callback] - Optional callback. Use instead of Promise return value as desired. |
| 197 | * @returns {Promise<TransactionFeed>} Newly created transaction feed |
| 198 | */ |
| 199 | create: (params, cb) => { |
| 200 | let body = Object.assign({ clientToken: uuid.v4() }, params) |
| 201 | return shared.tryCallback( |
| 202 | client.request('/create-transaction-feed', body).then(data => new TransactionFeed(data, client)), |
| 203 | cb |
| 204 | ) |
| 205 | }, |
| 206 | |
| 207 | /** |
| 208 | * Get single transaction feed given an id/alias. |
| 209 | * |
| 210 | * @param {Object} params - Parameters to get single Transaction Feed. |
| 211 | * @param {String} params.id - The unique ID of a transaction feed. Either `id` or |
| 212 | * `alias` is required. |
| 213 | * @param {String} params.alias - The unique alias of a transaction feed. Either `id` or |
| 214 | * `alias` is required. |
| 215 | * @param {objectCallback} [callback] - Optional callback. Use instead of Promise return value as desired. |
| 216 | * @returns {Promise<TransactionFeed>} Requested transaction feed object |
| 217 | */ |
| 218 | get: (params, cb) => shared.tryCallback( |
| 219 | client.request('/get-transaction-feed', params).then(data => new TransactionFeed(data, client)), |
| 220 | cb |
| 221 | ), |
| 222 | |
| 223 | /** |
| 224 | * Delete a transaction feed given an id/alias. |
| 225 | * |
| 226 | * @param {Object} params - Parameters to delete single Transaction Feed. |
| 227 | * @param {String} params.id - The unique ID of a transaction feed. Either `id` or |
| 228 | * `alias` is required. |
| 229 | * @param {String} params.alias - The unique alias of a transaction feed. Either `id` or |
| 230 | * `alias` is required. |
| 231 | * @param {objectCallback} [callback] - Optional callback. Use instead of Promise return value as desired. |
| 232 | * @return {Promise} Promise resolved on success |
| 233 | */ |
| 234 | delete: (params, cb) => shared.tryCallback( |
| 235 | client.request('/delete-transaction-feed', params).then(data => data), |
| 236 | cb |
| 237 | ), |
| 238 | |
| 239 | |
| 240 | /** |
| 241 | * Get one page of transaction feeds. |
| 242 | * |
| 243 | * @param {Object} params={} - Pagination information. |
no test coverage detected