UNPKG

portkey-ai

Version:
54 lines 2.96 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Labels = void 0; const constants_1 = require("../constants.js"); const apiResource_1 = require("../apiResource.js"); const utils_1 = require("../utils.js"); const createHeaders_1 = require("./createHeaders.js"); class Labels extends apiResource_1.ApiResource { create(_body, params, opts) { const body = _body; if (params) { const config = (0, utils_1.overrideConfig)(this.client.config, params.config); this.client.customHeaders = Object.assign(Object.assign({}, this.client.customHeaders), (0, createHeaders_1.createHeaders)(Object.assign(Object.assign({}, params), { config }))); } const response = this.post(`${constants_1.LABELS_API}`, Object.assign({ body }, opts)); return response; } list(_query, params, opts) { const query = _query ? (0, utils_1.toQueryParams)(_query) : ''; if (params) { const config = (0, utils_1.overrideConfig)(this.client.config, params.config); this.client.customHeaders = Object.assign(Object.assign({}, this.client.customHeaders), (0, createHeaders_1.createHeaders)(Object.assign(Object.assign({}, params), { config }))); } const response = this.getMethod(`${constants_1.LABELS_API}${query}`, Object.assign({}, opts)); return response; } retrieve(labelId, params, opts) { if (params) { const config = (0, utils_1.overrideConfig)(this.client.config, params.config); this.client.customHeaders = Object.assign(Object.assign({}, this.client.customHeaders), (0, createHeaders_1.createHeaders)(Object.assign(Object.assign({}, params), { config }))); } const response = this.getMethod(`${constants_1.LABELS_API}/${labelId}`, Object.assign({}, opts)); return response; } update(labelId, _body, params, opts) { const body = _body; if (params) { const config = (0, utils_1.overrideConfig)(this.client.config, params.config); this.client.customHeaders = Object.assign(Object.assign({}, this.client.customHeaders), (0, createHeaders_1.createHeaders)(Object.assign(Object.assign({}, params), { config }))); } const response = this.put(`${constants_1.LABELS_API}/${labelId}`, Object.assign({ body }, opts)); return response; } delete(labelId, params, opts) { if (params) { const config = (0, utils_1.overrideConfig)(this.client.config, params.config); this.client.customHeaders = Object.assign(Object.assign({}, this.client.customHeaders), (0, createHeaders_1.createHeaders)(Object.assign(Object.assign({}, params), { config }))); } const response = this.deleteMethod(`${constants_1.LABELS_API}/${labelId}`, Object.assign({}, opts)); return response; } } exports.Labels = Labels; //# sourceMappingURL=labels.js.map