UNPKG

@controlplane/cli

Version:

Control Plane Corporation CLI

40 lines 1.15 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.RestClient = void 0; class RestClient { constructor(axios) { this.axios = axios; } /** * does a POST, follows the location header and retrieves it * @param path * @param body */ async create(path, body, cfg) { let res = await this.axios.post(path, body, cfg); let link = res.headers.location; res = await this.axios.get(link); return res.data; } async delete(path, cfg) { await this.axios.delete(path, cfg); } async patch(path, body, cfg) { const res = await this.axios.patch(path, body, cfg); return res.data; } async get(path, cfg) { const res = await this.axios.get(path, cfg); return res.data; } async post(path, body, cfg) { const res = await this.axios.post(path, body, cfg); return res.data; } async put(path, body, cfg) { const res = await this.axios.put(path, body, cfg); return res.data; } } exports.RestClient = RestClient; //# sourceMappingURL=client.js.map