kubo-rpc-client-esm-cjs
Version:
A client library for the Kubo RPC API
24 lines • 736 B
JavaScript
import { configure } from '../lib/configure.js';
import { toUrlSearchParams } from '../lib/to-url-search-params.js';
export const createGet = configure(api => {
/**
* @type {import('../types.js').ConfigAPI["get"]}
*/
const get = async (key, options = {}) => {
if (!key) {
throw new Error('key argument is required');
}
const res = await api.post('config', {
signal: options.signal,
searchParams: toUrlSearchParams({
arg: key,
...options
}),
headers: options.headers
});
const data = await res.json();
return data.Value;
};
return get;
});
//# sourceMappingURL=get.js.map