1
0
mirror of https://github.com/bigchaindb/js-bigchaindb-driver.git synced 2024-11-22 09:46:58 +01:00

Merge pull request #7 from bigchaindb/text-search-support

Text search support
This commit is contained in:
Matthias Kretschmann 2017-06-12 15:15:29 +02:00 committed by GitHub
commit 7e8b062698

View File

@ -8,6 +8,7 @@ export default class Connection {
} }
getApiUrls(endpoints) { getApiUrls(endpoints) {
// TODO: Use camel case
return { return {
'blocks': this.path + 'blocks', 'blocks': this.path + 'blocks',
'blocks_detail': this.path + 'blocks/%(blockId)s', 'blocks_detail': this.path + 'blocks/%(blockId)s',
@ -15,6 +16,7 @@ export default class Connection {
'statuses': this.path + 'statuses', 'statuses': this.path + 'statuses',
'transactions': this.path + 'transactions', 'transactions': this.path + 'transactions',
'transactions_detail': this.path + 'transactions/%(txId)s', 'transactions_detail': this.path + 'transactions/%(txId)s',
'search_assets': this.path + 'assets',
'votes': this.path + 'votes' 'votes': this.path + 'votes'
}[endpoints]; }[endpoints];
} }
@ -155,4 +157,18 @@ export default class Connection {
jsonBody: transaction jsonBody: transaction
}) })
} }
/**
* @public
*
* @param transaction
*/
searchAssets(query) {
return this.req(this.getApiUrls('search_assets'), {
query: {
text_search: query
}
})
}
} }