UNPKG

@kontent-ai/management-sdk

Version:
35 lines 1.16 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.BaseMapper = void 0; const models_1 = require("../models"); const responses_1 = require("../responses"); class BaseMapper { mapResponseDebug(baseResponse) { if (!baseResponse) { throw Error(`Cannot map debug model from the response`); } return { response: baseResponse }; } mapPagination(rawPagination) { return new models_1.SharedModels.Pagination(rawPagination.continuation_token, rawPagination.next_page); } mapReference(rawReference) { return new models_1.SharedModels.ReferenceObject({ codename: rawReference.codename, externalId: rawReference.external_id, id: rawReference.id }); } mapIdReference(rawReference) { return { id: rawReference.id }; } mapEmptyResponse(response) { return new responses_1.BaseResponses.EmptyContentManagementResponse(this.mapResponseDebug(response), undefined, undefined); } } exports.BaseMapper = BaseMapper; //# sourceMappingURL=base-mapper.js.map