options.json = options.data
if (options.data && Object.keys(options.data).length > 0) debug(options.data)
return requestPromise(options).then(client.handleVaultResponse)
}
client.help = (path, requestOptions) => {
debug(`help for ${path}`)
const options = Object.assign({}, config.requestOptions, requestOptions)
options.path = `/${path}?help=1`
options.method = 'GET'
return client.request(options)
}
client.write = (path, data, requestOptions) => {
debug('write %o to %s', data, path)
const options = Object.assign({}, config.requestOptions, requestOptions)
options.path = `/${path}`
options.json = data
options.method = 'PUT'
return client.request(options)
}
client.read = (path, requestOptions) => {
debug(`read ${path}`)
const options = Object.assign({}, config.requestOptions, requestOptions)
options.path = `/${path}`
options.method = 'GET'
return client.request(options)
}
client.list = (path, requestOptions) => {
debug(`list ${path}`)
const options = Object.assign({}, config.requestOptions, requestOptions)
options.path = `/${path}`
if (client.noCustomHTTPVerbs) {
options.path = `/${path}?list=1`
options.method = 'GET'
} else {
options.path = `/${path}`
options.method = 'LIST'
}
return client.request(options)
}
client.delete = (path, requestOptions) => {
debug(`delete ${path}`)
const options = Object.assign({}, config.requestOptions, requestOptions)
options.path = `/${path}`
options.method = 'DELETE'
return client.request(options)
}
function validate(json, schema) {