UNPKG

@bitmovin/api-sdk

Version:

Bitmovin JS/TS API SDK

68 lines (67 loc) 2.13 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const BaseAPI_1 = require("../../common/BaseAPI"); const Mapper_1 = require("../../common/Mapper"); const AccountApiKey_1 = require("../../models/AccountApiKey"); const BitmovinResponse_1 = require("../../models/BitmovinResponse"); const PaginationResponse_1 = require("../../models/PaginationResponse"); /** * ApiKeysApi - object-oriented interface * @export * @class ApiKeysApi * @extends {BaseAPI} */ class ApiKeysApi extends BaseAPI_1.BaseAPI { constructor(configuration) { super(configuration); } /** * @summary Create Api Key * @throws {BitmovinError} * @memberof ApiKeysApi */ create() { return this.restClient.post('/account/api-keys', {}).then((response) => { return (0, Mapper_1.map)(response, AccountApiKey_1.default); }); } /** * @summary Delete Api Key * @param {string} apiKeyId Id of the api key * @throws {BitmovinError} * @memberof ApiKeysApi */ delete(apiKeyId) { const pathParamMap = { api_key_id: apiKeyId }; return this.restClient.delete('/account/api-keys/{api_key_id}', pathParamMap).then((response) => { return (0, Mapper_1.map)(response, BitmovinResponse_1.default); }); } /** * @summary Get Api Key * @param {string} apiKeyId Id of the api key * @throws {BitmovinError} * @memberof ApiKeysApi */ get(apiKeyId) { const pathParamMap = { api_key_id: apiKeyId }; return this.restClient.get('/account/api-keys/{api_key_id}', pathParamMap).then((response) => { return (0, Mapper_1.map)(response, AccountApiKey_1.default); }); } /** * @summary List Api Keys * @throws {BitmovinError} * @memberof ApiKeysApi */ list() { return this.restClient.get('/account/api-keys', {}).then((response) => { return new PaginationResponse_1.default(response, AccountApiKey_1.default); }); } } exports.default = ApiKeysApi;