UNPKG

portkey-ai

Version:
56 lines 2.47 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ApiKeys = void 0; const apiResource_1 = require("../apiResource.js"); const createHeaders_1 = require("./createHeaders.js"); const utils_1 = require("../utils.js"); class ApiKeys extends apiResource_1.ApiResource { create(_body, params, opts) { const body = _body; const type = body.type; const subType = body['sub-type']; if (params) { this.client.customHeaders = Object.assign(Object.assign({}, this.client.customHeaders), (0, createHeaders_1.createHeaders)(Object.assign({}, params))); } const response = this.post(`/api-keys/${type}/${subType}`, Object.assign({ body }, opts)); return response; } retrieve(_body, params, opts) { const body = _body; const id = body.id; if (params) { this.client.customHeaders = Object.assign(Object.assign({}, this.client.customHeaders), (0, createHeaders_1.createHeaders)(Object.assign({}, params))); } const response = this.getMethod(`/api-keys/${id}`, Object.assign({}, opts)); return response; } update(_body, params, opts) { const body = _body; const id = body.id; if (params) { this.client.customHeaders = Object.assign(Object.assign({}, this.client.customHeaders), (0, createHeaders_1.createHeaders)(Object.assign({}, params))); } const response = this.put(`/api-keys/${id}`, 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(`/api-keys${query}`, Object.assign({}, opts)); return response; } delete(_body, params, opts) { const body = _body; const id = body.id; if (params) { this.client.customHeaders = Object.assign(Object.assign({}, this.client.customHeaders), (0, createHeaders_1.createHeaders)(Object.assign({}, params))); } const response = this.deleteMethod(`/api-keys/${id}`, Object.assign({ body }, opts)); return response; } } exports.ApiKeys = ApiKeys; //# sourceMappingURL=apiKeys.js.map