portkey-ai
Version:
Node client library for the Portkey API
61 lines • 2.85 kB
JavaScript
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.VirtualKeys = void 0;
const apiResource_1 = require("../apiResource.js");
const createHeaders_1 = require("./createHeaders.js");
const utils_1 = require("../utils.js");
class VirtualKeys extends apiResource_1.ApiResource {
create(body, params, opts) {
if (params) {
this.client.customHeaders = Object.assign(Object.assign({}, this.client.customHeaders), (0, createHeaders_1.createHeaders)(Object.assign({}, params)));
}
const response = this.post('/virtual-keys', Object.assign({ body }, opts));
return response;
}
list(_body, params, opts) {
const body = _body;
if (params) {
this.client.customHeaders = Object.assign(Object.assign({}, this.client.customHeaders), (0, createHeaders_1.createHeaders)(Object.assign({}, params)));
}
const query = (0, utils_1.toQueryParams)(body);
const response = this.getMethod(`/virtual-keys${query}`, Object.assign({}, opts));
return response;
}
retrieve(body, params, opts) {
const { slug } = body;
if (params) {
this.client.customHeaders = Object.assign(Object.assign({}, this.client.customHeaders), (0, createHeaders_1.createHeaders)(Object.assign({}, params)));
}
const response = this.getMethod(`/virtual-keys/${slug}`, Object.assign({}, opts));
return response;
}
update(body, params, opts) {
const { slug } = body, restBody = __rest(body, ["slug"]);
if (params) {
this.client.customHeaders = Object.assign(Object.assign({}, this.client.customHeaders), (0, createHeaders_1.createHeaders)(Object.assign({}, params)));
}
const response = this.put(`/virtual-keys/${slug}`, Object.assign({ body: restBody }, opts));
return response;
}
delete(body, params, opts) {
const { slug } = body;
if (params) {
this.client.customHeaders = Object.assign(Object.assign({}, this.client.customHeaders), (0, createHeaders_1.createHeaders)(Object.assign({}, params)));
}
const response = this.deleteMethod(`/virtual-keys/${slug}`, Object.assign({}, opts));
return response;
}
}
exports.VirtualKeys = VirtualKeys;
//# sourceMappingURL=virtualKeys.js.map
;