@gateway.fm/gtw-dvf-client-js
Version:
DVF client js lib with gateway.fm rpc endpoints
17 lines (13 loc) • 396 B
JavaScript
const { post } = require('request-promise')
const _ = require('lodash')
module.exports = async (dvf, endpoint, json = {}, headers = {}) => {
const url = dvf.config.api + endpoint
headers = { ...headers, Authorization: dvf.config.apiKey }
const options = {
uri: url,
headers,
// removes null and undefined values
json: _.omitBy(json, _.isNil)
}
return post(options)
}