@bitmovin/api-sdk
Version:
Bitmovin JS/TS API SDK
78 lines (77 loc) • 2.78 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const BaseAPI_1 = require("../../../common/BaseAPI");
const Mapper_1 = require("../../../common/Mapper");
const BitmovinResponse_1 = require("../../../models/BitmovinResponse");
const StaticIp_1 = require("../../../models/StaticIp");
const PaginationResponse_1 = require("../../../models/PaginationResponse");
const StaticIpListQueryParams_1 = require("./StaticIpListQueryParams");
/**
* StaticIpsApi - object-oriented interface
* @export
* @class StaticIpsApi
* @extends {BaseAPI}
*/
class StaticIpsApi extends BaseAPI_1.BaseAPI {
constructor(configuration) {
super(configuration);
}
/**
* @summary Add Static IP Address
* @param {StaticIp} staticIp The static ip to be created
* @throws {BitmovinError}
* @memberof StaticIpsApi
*/
create(staticIp) {
return this.restClient.post('/encoding/infrastructure/static-ips', {}, staticIp).then((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
*/
delete(id) {
const pathParamMap = {
id: id
};
return this.restClient.delete('/encoding/infrastructure/static-ips/{id}', pathParamMap).then((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
*/
get(id) {
const pathParamMap = {
id: id
};
return this.restClient.get('/encoding/infrastructure/static-ips/{id}', pathParamMap).then((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
*/
list(queryParameters) {
let 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((response) => {
return new PaginationResponse_1.default(response, StaticIp_1.default);
});
}
}
exports.default = StaticIpsApi;