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

Connection.req -> Connection._req

This commit is contained in:
Tim Daubenschütz 2017-05-14 20:03:54 +02:00
parent 95f39ed23e
commit 8f778f4c97

View File

@ -19,7 +19,7 @@ export default class Connection {
}[endpoints]; }[endpoints];
} }
req(path, options={}) { _req(path, options={}) {
// NOTE: `options.headers` could be undefined, but that's OK. // NOTE: `options.headers` could be undefined, but that's OK.
options.headers = Object.assign({}, options.headers, this.headers) options.headers = Object.assign({}, options.headers, this.headers)
return request(path, options) return request(path, options)
@ -30,7 +30,7 @@ export default class Connection {
* @param blockId * @param blockId
*/ */
getBlock(blockId) { getBlock(blockId) {
return this.req(this.getApiUrls('blocks_detail'), { return this._req(this.getApiUrls('blocks_detail'), {
urlTemplateSpec: { urlTemplateSpec: {
blockId blockId
} }
@ -42,7 +42,7 @@ export default class Connection {
* @param tx_id * @param tx_id
*/ */
getStatus(tx_id) { getStatus(tx_id) {
return this.req(this.getApiUrls('statuses'), { return this._req(this.getApiUrls('statuses'), {
query: { query: {
tx_id tx_id
} }
@ -54,7 +54,7 @@ export default class Connection {
* @param txId * @param txId
*/ */
getTransaction(txId) { getTransaction(txId) {
return this.req(this.getApiUrls('transactions_detail'), { return this._req(this.getApiUrls('transactions_detail'), {
urlTemplateSpec: { urlTemplateSpec: {
txId txId
} }
@ -67,7 +67,7 @@ export default class Connection {
* @param status * @param status
*/ */
listBlocks({ tx_id, status }) { listBlocks({ tx_id, status }) {
return this.req(this.getApiUrls('blocks'), { return this._req(this.getApiUrls('blocks'), {
query: { query: {
tx_id, tx_id,
status status
@ -82,7 +82,7 @@ export default class Connection {
* @param onlyJsonResponse * @param onlyJsonResponse
*/ */
listOutputs({ public_key, unspent }, onlyJsonResponse=true) { listOutputs({ public_key, unspent }, onlyJsonResponse=true) {
return this.req(this.getApiUrls('outputs'), { return this._req(this.getApiUrls('outputs'), {
query: { query: {
public_key, public_key,
unspent unspent
@ -96,7 +96,7 @@ export default class Connection {
* @param operation * @param operation
*/ */
listTransactions({ asset_id, operation }) { listTransactions({ asset_id, operation }) {
return this.req(this.getApiUrls('transactions'), { return this._req(this.getApiUrls('transactions'), {
query: { query: {
asset_id, asset_id,
operation operation
@ -109,7 +109,7 @@ export default class Connection {
* @param block_id * @param block_id
*/ */
listVotes(block_id) { listVotes(block_id) {
return this.req(this.getApiUrls('votes'), { return this._req(this.getApiUrls('votes'), {
query: { query: {
block_id block_id
} }
@ -150,7 +150,7 @@ export default class Connection {
* @param transaction * @param transaction
*/ */
postTransaction(transaction) { postTransaction(transaction) {
return this.req(this.getApiUrls('transactions'), { return this._req(this.getApiUrls('transactions'), {
method: 'POST', method: 'POST',
jsonBody: transaction jsonBody: transaction
}) })