UNPKG

@bitmovin/api-sdk

Version:

Bitmovin JS/TS API SDK

105 lines (104 loc) 4.11 kB
"use strict"; 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 BitmovinResponseList_1 = require("../../../../models/BitmovinResponseList"); const DnsMappingResponse_1 = require("../../../../models/DnsMappingResponse"); const PaginationResponse_1 = require("../../../../models/PaginationResponse"); const DnsMappingResponseListQueryParams_1 = require("./DnsMappingResponseListQueryParams"); /** * DnsMappingsApi - object-oriented interface * @export * @class DnsMappingsApi * @extends {BaseAPI} */ class DnsMappingsApi extends BaseAPI_1.BaseAPI { constructor(configuration) { super(configuration); } /** * @summary Create new DNS mapping for encoding * @param {string} encodingId Id of the encoding. * @param {DnsMappingRequest} dnsMappingRequest The DNS mapping to be created * @throws {BitmovinError} * @memberof DnsMappingsApi */ create(encodingId, dnsMappingRequest) { const pathParamMap = { encoding_id: encodingId }; return this.restClient.post('/encoding/live/encodings/{encoding_id}/dns-mappings', pathParamMap, dnsMappingRequest).then((response) => { return (0, Mapper_1.map)(response, DnsMappingResponse_1.default); }); } /** * @summary Delete DNS mapping * @param {string} encodingId Id of the encoding. * @param {string} id Id of the DNS mapping * @throws {BitmovinError} * @memberof DnsMappingsApi */ delete(encodingId, id) { const pathParamMap = { encoding_id: encodingId, id: id }; return this.restClient.delete('/encoding/live/encodings/{encoding_id}/dns-mappings/{id}', pathParamMap).then((response) => { return (0, Mapper_1.map)(response, BitmovinResponse_1.default); }); } /** * @summary Delete all DNS mappings for encoding * @param {string} encodingId Id of the encoding. * @throws {BitmovinError} * @memberof DnsMappingsApi */ deleteAll(encodingId) { const pathParamMap = { encoding_id: encodingId }; return this.restClient.delete('/encoding/live/encodings/{encoding_id}/dns-mappings', pathParamMap).then((response) => { return (0, Mapper_1.map)(response, BitmovinResponseList_1.default); }); } /** * @summary DNS mapping details * @param {string} encodingId Id of the encoding. * @param {string} id Id of the DNS mapping * @throws {BitmovinError} * @memberof DnsMappingsApi */ get(encodingId, id) { const pathParamMap = { encoding_id: encodingId, id: id }; return this.restClient.get('/encoding/live/encodings/{encoding_id}/dns-mappings/{id}', pathParamMap).then((response) => { return (0, Mapper_1.map)(response, DnsMappingResponse_1.default); }); } /** * @summary List DNS mappings for encoding * @param {string} encodingId Id of the encoding. * @param {*} [queryParameters] query parameters for filtering, sorting and pagination * @throws {BitmovinError} * @memberof DnsMappingsApi */ list(encodingId, queryParameters) { const pathParamMap = { encoding_id: encodingId }; let queryParams = {}; if (typeof queryParameters === 'function') { queryParams = queryParameters(new DnsMappingResponseListQueryParams_1.DnsMappingResponseListQueryParamsBuilder()).buildQueryParams(); } else if (queryParameters) { queryParams = queryParameters; } return this.restClient.get('/encoding/live/encodings/{encoding_id}/dns-mappings', pathParamMap, queryParams).then((response) => { return new PaginationResponse_1.default(response, DnsMappingResponse_1.default); }); } } exports.default = DnsMappingsApi;