@bitmovin/api-sdk
Version:
Bitmovin JS/TS API SDK
85 lines (84 loc) • 3.16 kB
JavaScript
;
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var BaseAPI_1 = require("../../common/BaseAPI");
var Mapper_1 = require("../../common/Mapper");
var AccountApiKey_1 = require("../../models/AccountApiKey");
var BitmovinResponse_1 = require("../../models/BitmovinResponse");
var PaginationResponse_1 = require("../../models/PaginationResponse");
/**
* ApiKeysApi - object-oriented interface
* @export
* @class ApiKeysApi
* @extends {BaseAPI}
*/
var ApiKeysApi = /** @class */ (function (_super) {
__extends(ApiKeysApi, _super);
function ApiKeysApi(configuration) {
return _super.call(this, configuration) || this;
}
/**
* @summary Create Api Key
* @throws {BitmovinError}
* @memberof ApiKeysApi
*/
ApiKeysApi.prototype.create = function () {
return this.restClient.post('/account/api-keys', {}).then(function (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
*/
ApiKeysApi.prototype.delete = function (apiKeyId) {
var pathParamMap = {
api_key_id: apiKeyId
};
return this.restClient.delete('/account/api-keys/{api_key_id}', pathParamMap).then(function (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
*/
ApiKeysApi.prototype.get = function (apiKeyId) {
var pathParamMap = {
api_key_id: apiKeyId
};
return this.restClient.get('/account/api-keys/{api_key_id}', pathParamMap).then(function (response) {
return (0, Mapper_1.map)(response, AccountApiKey_1.default);
});
};
/**
* @summary List Api Keys
* @throws {BitmovinError}
* @memberof ApiKeysApi
*/
ApiKeysApi.prototype.list = function () {
return this.restClient.get('/account/api-keys', {}).then(function (response) {
return new PaginationResponse_1.default(response, AccountApiKey_1.default);
});
};
return ApiKeysApi;
}(BaseAPI_1.BaseAPI));
exports.default = ApiKeysApi;