@kontent-ai/management-sdk
Version:
Official Kontent.ai management SDK
31 lines • 1 kB
JavaScript
import { SharedModels } from '../models';
import { BaseResponses } from '../responses';
export class BaseMapper {
mapResponseDebug(baseResponse) {
if (!baseResponse) {
throw Error(`Cannot map debug model from the response`);
}
return {
response: baseResponse
};
}
mapPagination(rawPagination) {
return new SharedModels.Pagination(rawPagination.continuation_token, rawPagination.next_page);
}
mapReference(rawReference) {
return new SharedModels.ReferenceObject({
codename: rawReference.codename,
externalId: rawReference.external_id,
id: rawReference.id
});
}
mapIdReference(rawReference) {
return {
id: rawReference.id
};
}
mapEmptyResponse(response) {
return new BaseResponses.EmptyContentManagementResponse(this.mapResponseDebug(response), undefined, undefined);
}
}
//# sourceMappingURL=base-mapper.js.map