From 65c4c43f2319517ba750ea3c4cadbddcb68517e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Daubensch=C3=BCtz?= Date: Sun, 14 May 2017 16:35:47 +0200 Subject: [PATCH] Add text search support --- src/connection/index.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/connection/index.js b/src/connection/index.js index 5262d59..553bf74 100644 --- a/src/connection/index.js +++ b/src/connection/index.js @@ -8,6 +8,7 @@ export default class Connection { } getApiUrls(endpoints) { + // TODO: Use camel case return { 'blocks': this.path + 'blocks', 'blocks_detail': this.path + 'blocks/%(blockId)s', @@ -15,6 +16,7 @@ export default class Connection { 'statuses': this.path + 'statuses', 'transactions': this.path + 'transactions', 'transactions_detail': this.path + 'transactions/%(txId)s', + 'search_assets': this.path + 'assets', 'votes': this.path + 'votes' }[endpoints]; } @@ -155,4 +157,18 @@ export default class Connection { jsonBody: transaction }) } + + + /** + * @public + * + * @param transaction + */ + searchAssets(query) { + return this.req(this.getApiUrls('search_assets'), { + query: { + text_search: query + } + }) + } }