@bitmovin/api-sdk
Version:
Bitmovin JS/TS API SDK
95 lines (94 loc) • 3.83 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 BitmovinResponse_1 = require("../../../models/BitmovinResponse");
var StaticIp_1 = require("../../../models/StaticIp");
var PaginationResponse_1 = require("../../../models/PaginationResponse");
var StaticIpListQueryParams_1 = require("./StaticIpListQueryParams");
/**
* StaticIpsApi - object-oriented interface
* @export
* @class StaticIpsApi
* @extends {BaseAPI}
*/
var StaticIpsApi = /** @class */ (function (_super) {
__extends(StaticIpsApi, _super);
function StaticIpsApi(configuration) {
return _super.call(this, configuration) || this;
}
/**
* @summary Add Static IP Address
* @param {StaticIp} staticIp The static ip to be created
* @throws {BitmovinError}
* @memberof StaticIpsApi
*/
StaticIpsApi.prototype.create = function (staticIp) {
return this.restClient.post('/encoding/infrastructure/static-ips', {}, staticIp).then(function (response) {
return (0, Mapper_1.map)(response, StaticIp_1.default);
});
};
/**
* @summary Delete Static IP Address
* @param {string} id Id of the Static IP Address
* @throws {BitmovinError}
* @memberof StaticIpsApi
*/
StaticIpsApi.prototype.delete = function (id) {
var pathParamMap = {
id: id
};
return this.restClient.delete('/encoding/infrastructure/static-ips/{id}', pathParamMap).then(function (response) {
return (0, Mapper_1.map)(response, BitmovinResponse_1.default);
});
};
/**
* @summary Static IP Address Details
* @param {string} id Id of the Static IP Address
* @throws {BitmovinError}
* @memberof StaticIpsApi
*/
StaticIpsApi.prototype.get = function (id) {
var pathParamMap = {
id: id
};
return this.restClient.get('/encoding/infrastructure/static-ips/{id}', pathParamMap).then(function (response) {
return (0, Mapper_1.map)(response, StaticIp_1.default);
});
};
/**
* @summary List all Static IP Addresses
* @param {*} [queryParameters] query parameters for filtering, sorting and pagination
* @throws {BitmovinError}
* @memberof StaticIpsApi
*/
StaticIpsApi.prototype.list = function (queryParameters) {
var queryParams = {};
if (typeof queryParameters === 'function') {
queryParams = queryParameters(new StaticIpListQueryParams_1.StaticIpListQueryParamsBuilder()).buildQueryParams();
}
else if (queryParameters) {
queryParams = queryParameters;
}
return this.restClient.get('/encoding/infrastructure/static-ips', {}, queryParams).then(function (response) {
return new PaginationResponse_1.default(response, StaticIp_1.default);
});
};
return StaticIpsApi;
}(BaseAPI_1.BaseAPI));
exports.default = StaticIpsApi;