be-api-client
Advanced tools
Comparing version 0.0.42 to 0.0.43
111
index.js
@@ -60,23 +60,2 @@ const rp = require('request-promise-native') | ||
async function doPut(route, form={}){ | ||
const options = { | ||
method: 'PUT', | ||
uri: config.apiServerAddress + route, | ||
json: true, | ||
form, | ||
headers: { | ||
'Content-Type': 'application/x-www-form-urlencoded', | ||
} | ||
} | ||
try{ | ||
return await rp(options) | ||
} catch(err){ | ||
return { | ||
result: false, | ||
route, | ||
err | ||
} | ||
} | ||
} | ||
async function isAPIRunning(){ | ||
@@ -232,5 +211,6 @@ return await doGet('/isAPIRunning') | ||
async function addUser(id){ | ||
async function addUser(id, role){ | ||
const form = { | ||
id | ||
id, | ||
role | ||
} | ||
@@ -240,6 +220,2 @@ return await doPost('/users', form) | ||
async function getUser(id){ | ||
return await doGet('/users/' + id) | ||
} | ||
async function getUsers(){ | ||
@@ -266,72 +242,2 @@ return await doGet('/users') | ||
async function addInstruction(country, legalEntity, currency, account, amountRequestedToTokenize, requestedBy){ | ||
const form = { | ||
country, | ||
legalEntity, | ||
currency, | ||
account, | ||
amountRequestedToTokenize, | ||
requestedBy | ||
} | ||
return await doPost('/instructions', form) | ||
} | ||
async function getInstructions(){ | ||
return await doGet('/instructions') | ||
} | ||
async function addOrUpdateIssuance(_id, country, legalEntity, currency, account, accountBalance, amountRequestedToTokenize, requestedBy, dateTime, status){ | ||
const form = { | ||
_id, | ||
country, | ||
legalEntity, | ||
currency, | ||
account, | ||
accountBalance, | ||
amountRequestedToTokenize, | ||
requestedBy, | ||
dateTime, | ||
status | ||
} | ||
return await doPut('/issuances', form) | ||
} | ||
async function getIssuances(){ | ||
return await doGet('/issuances') | ||
} | ||
async function addRedemption(country, legalEntity, currency, account, amountRequestedToRedeem, requestedBy){ | ||
const form = { | ||
country, | ||
legalEntity, | ||
currency, | ||
account, | ||
amountRequestedToRedeem, | ||
requestedBy | ||
} | ||
return await doPost('/redemptions', form) | ||
} | ||
async function getRedemptions(){ | ||
return await doGet('/redemptions') | ||
} | ||
async function addPayment(receivingBank, reference, debtorDetails, creditorDetails, sendingCurrency, receivingCurrency, rate){ | ||
const form = { | ||
receivingBank, | ||
reference, | ||
debtorDetails, | ||
creditorDetails, | ||
sendingCurrency, | ||
receivingCurrency, | ||
rate | ||
} | ||
return await doPost('/payments', form) | ||
} | ||
async function getPayments(){ | ||
return await doGet('/payments') | ||
} | ||
return { | ||
@@ -359,15 +265,6 @@ isAPIRunning, | ||
addUser, | ||
getUser, | ||
getUsers, | ||
entityId, | ||
contractIds, | ||
tokenize, | ||
addInstruction, | ||
getInstructions, | ||
addOrUpdateIssuance, | ||
getIssuances, | ||
addRedemption, | ||
getRedemptions, | ||
addPayment, | ||
getPayments | ||
tokenize | ||
} | ||
@@ -374,0 +271,0 @@ } |
{ | ||
"name": "be-api-client", | ||
"version": "0.0.42", | ||
"version": "0.0.43", | ||
"description": "A node.js client for the be-api.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
7851
238