UNPKG

@kontent-ai/management-sdk

Version:
654 lines 31.8 kB
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; import { assetFolderMapper, assetsMapper, contentItemsMapper, contentTypeMapper, contentTypeSnippetMapper, languageMapper, languageVariantMapper, environmentMapper, taxonomyMappper, workflowMapper, genericMapper, collectionsMappers, subscriptionMapper, roleMapper, projectUserMapper, assetRenditionMapper, spacesMapper, previewMapper, webSpotlightMapper, customAppMapper } from '../mappers'; import { webhookMapper } from '../mappers/webhook-mapper'; import { BaseManagementQueryService } from './base-management-service.class'; export class ManagementQueryService extends BaseManagementQueryService { constructor(config, httpService, sdkInfo) { super(config, httpService, sdkInfo); this.config = config; this.httpService = httpService; this.sdkInfo = sdkInfo; } genericPostResponseAsync(url, data, config) { const _super = Object.create(null, { postResponseAsync: { get: () => super.postResponseAsync } }); return __awaiter(this, void 0, void 0, function* () { return genericMapper.mapGenericResponse(yield _super.postResponseAsync.call(this, url, data, {}, config)); }); } genericPatchResponseAsync(url, data, config) { const _super = Object.create(null, { patchResponseAsync: { get: () => super.patchResponseAsync } }); return __awaiter(this, void 0, void 0, function* () { return genericMapper.mapGenericResponse(yield _super.patchResponseAsync.call(this, url, data, {}, config)); }); } genericDeleteResponseAsync(url, config) { const _super = Object.create(null, { deleteResponseAsync: { get: () => super.deleteResponseAsync } }); return __awaiter(this, void 0, void 0, function* () { return genericMapper.mapGenericResponse(yield _super.deleteResponseAsync.call(this, url, {}, config)); }); } genericGetResponseAsync(url, config) { const _super = Object.create(null, { getResponseAsync: { get: () => super.getResponseAsync } }); return __awaiter(this, void 0, void 0, function* () { return genericMapper.mapGenericResponse(yield _super.getResponseAsync.call(this, url, {}, config)); }); } genericPutResponseAsync(url, data, config) { const _super = Object.create(null, { putResponseAsync: { get: () => super.putResponseAsync } }); return __awaiter(this, void 0, void 0, function* () { return genericMapper.mapGenericResponse(yield _super.putResponseAsync.call(this, url, data, {}, config)); }); } getListAllResponseAsync(data) { return __awaiter(this, void 0, void 0, function* () { const responses = yield this.getListAllResponseInternalAsync({ resolvedResponses: [], getResponse: data.getResponse, xContinuationToken: undefined, listQueryConfig: data.listQueryConfig }); return data.allResponseFactory(responses.reduce((prev, current) => { prev.push(...current.data.items); return prev; }, []), responses); }); } publishLanguageVariantAsync(url, data, config) { return __awaiter(this, void 0, void 0, function* () { return workflowMapper.mapEmptyResponse(yield this.putResponseAsync(url, data, {}, config)); }); } createNewVersionOfLanguageVariantAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return workflowMapper.mapEmptyResponse(yield this.putResponseAsync(url, undefined, {}, config)); }); } unpublishLanguageVariantAsync(url, data, config) { return __awaiter(this, void 0, void 0, function* () { return workflowMapper.mapEmptyResponse(yield this.putResponseAsync(url, data, {}, config)); }); } cancelScheduledPublishingOfLanguageVariantAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return workflowMapper.mapEmptyResponse(yield this.putResponseAsync(url, undefined, {}, config)); }); } cancelScheduledUnpublishingOfLanguageVariantAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return workflowMapper.mapEmptyResponse(yield this.putResponseAsync(url, undefined, {}, config)); }); } changeWorkflowOfLanguageVariantAsync(url, data, config) { return __awaiter(this, void 0, void 0, function* () { return workflowMapper.mapEmptyResponse(yield this.putResponseAsync(url, data, {}, config)); }); } listWorkflowsAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return workflowMapper.mapListWorkflowsResponse(yield this.getResponseAsync(url, {}, config)); }); } addWorkflowAsync(url, config, data) { return __awaiter(this, void 0, void 0, function* () { return workflowMapper.mapAddWorkflowResponse(yield this.postResponseAsync(url, data, {}, config)); }); } updateWorkflowAsync(url, config, data) { return __awaiter(this, void 0, void 0, function* () { return workflowMapper.mapUpdateWorkflowResponse(yield this.putResponseAsync(url, data, {}, config)); }); } deleteWorkflowAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return webhookMapper.mapEmptyResponse(yield this.deleteResponseAsync(url, {}, config)); }); } viewContentTypeSnippetAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return contentTypeSnippetMapper.mapViewContentTypeSnippetResponse(yield this.getResponseAsync(url, {}, config)); }); } deleteContentTypeSnippetAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return contentTypeSnippetMapper.mapEmptyResponse(yield this.deleteResponseAsync(url, {}, config)); }); } addContentTypeSnippetAsync(url, data, config) { return __awaiter(this, void 0, void 0, function* () { return contentTypeSnippetMapper.mapAddContentTypeSnippetResponse(yield this.postResponseAsync(url, data, {}, config)); }); } listContentTypeSnippetsAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return contentTypeSnippetMapper.mapListingResponse(yield this.getResponseAsync(url, {}, config)); }); } environmentInformationAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return environmentMapper.mapEnvironmentInformationResponse(yield this.getResponseAsync(url, {}, config)); }); } listEnvironmentValidationIssuesAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return environmentMapper.mapProjectValidationIssuesListResponse(yield this.getResponseAsync(url, {}, config)); }); } startEnvironmentValidationAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return environmentMapper.mapStartEnvironmentValidationResponse(yield this.postResponseAsync(url, {}, {}, config)); }); } checkEnvironmentValidationAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return environmentMapper.mapCheckEnvironmentValidationResponse(yield this.getResponseAsync(url, {}, config)); }); } addContentTypeAsync(url, data, config) { return __awaiter(this, void 0, void 0, function* () { return contentTypeMapper.mapAddContentTypeResponse(yield this.postResponseAsync(url, data, {}, config)); }); } deleteContentTypeAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return contentTypeMapper.mapEmptyResponse(yield this.deleteResponseAsync(url, {}, config)); }); } modifyContentTypeAsync(url, config, data) { return __awaiter(this, void 0, void 0, function* () { return contentTypeMapper.mapModifyContentTypeResponse(yield this.patchResponseAsync(url, data, {}, config)); }); } modifyTaxonomyAsync(url, config, data) { return __awaiter(this, void 0, void 0, function* () { return taxonomyMappper.mapModifyTaxonomyResponse(yield this.patchResponseAsync(url, data, {}, config)); }); } modifyContentTypeSnippetAsync(url, config, data) { return __awaiter(this, void 0, void 0, function* () { return contentTypeSnippetMapper.mapModifyContentTypeSnippetResponse(yield this.patchResponseAsync(url, data, {}, config)); }); } viewContentTypeAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return contentTypeMapper.mapViewContentTypeResponse(yield this.getResponseAsync(url, {}, config)); }); } listContentTypesAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return contentTypeMapper.mapListingResponse(yield this.getResponseAsync(url, {}, config)); }); } listAssetRenditionsAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return assetRenditionMapper.mapListAssetRenditionsResponse(yield this.getResponseAsync(url, {}, config)); }); } viewAssetRenditionAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return assetRenditionMapper.mapViewAssetRenditionResponse(yield this.getResponseAsync(url, {}, config)); }); } addAssetRenditionAsync(url, config, data) { return __awaiter(this, void 0, void 0, function* () { return assetRenditionMapper.mapAddAssetRenditionResponse(yield this.postResponseAsync(url, data, {}, config)); }); } modifyAssetRenditionAsync(url, config, data) { return __awaiter(this, void 0, void 0, function* () { return assetRenditionMapper.mapModifyAssetRenditionResponse(yield this.putResponseAsync(url, data, {}, config)); }); } addCustomAppAsync(url, data, config) { return __awaiter(this, void 0, void 0, function* () { return customAppMapper.mapAddCustomAppResponse(yield this.postResponseAsync(url, data, {}, config)); }); } modifyCustomAppAsync(url, data, config) { return __awaiter(this, void 0, void 0, function* () { return customAppMapper.mapModifyCustomAppResponse(yield this.patchResponseAsync(url, data, {}, config)); }); } deleteCustomAppAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return customAppMapper.mapEmptyResponse(yield this.deleteResponseAsync(url, {}, config)); }); } getCustomAppAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return customAppMapper.mapGetCustomAppResponse(yield this.getResponseAsync(url, {}, config)); }); } listCustomAppsAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return customAppMapper.mapListCustomAppsResponse(yield this.getResponseAsync(url, {}, config)); }); } addTaxonomyAsync(url, data, config) { return __awaiter(this, void 0, void 0, function* () { return taxonomyMappper.mapAddTaxonomyResponse(yield this.postResponseAsync(url, data, {}, config)); }); } deleteTaxonomyAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return taxonomyMappper.mapEmptyResponse(yield this.deleteResponseAsync(url, {}, config)); }); } getTaxonomyAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return taxonomyMappper.mapGetTaxonomyResponse(yield this.getResponseAsync(url, {}, config)); }); } listTaxonomiesAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return taxonomyMappper.mapListingTaxonomysResponse(yield this.getResponseAsync(url, {}, config)); }); } deleteAssetAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return assetsMapper.mapEmptyResponse(yield this.deleteResponseAsync(url, {}, config)); }); } upsertAssetAsync(url, data, config) { return __awaiter(this, void 0, void 0, function* () { return assetsMapper.mapUpsertAssetResponse(yield this.putResponseAsync(url, data, {}, config)); }); } addAssetAsync(url, data, config) { return __awaiter(this, void 0, void 0, function* () { return assetsMapper.mapAddAssetResponse(yield this.postResponseAsync(url, data, {}, config)); }); } listSubscriptionProjectsAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return subscriptionMapper.mapSubscriptionProjectsListResponse(yield this.getResponseAsync(url, {}, config)); }); } litSubscriptionUsersAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return subscriptionMapper.mapSubscriptionUsersListResponse(yield this.getResponseAsync(url, {}, config)); }); } viewSubscriptionProjectAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return subscriptionMapper.mapViewSubscriptionProjectResponse(yield this.getResponseAsync(url, {}, config)); }); } viewSubscriptionUserAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return subscriptionMapper.mapViewSubscriptionUserResponse(yield this.getResponseAsync(url, {}, config)); }); } activateUserInAllProjectsAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return contentItemsMapper.mapEmptyResponse(yield this.putResponseAsync(url, {}, {}, config)); }); } deactivateUserInAllProjectsAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return contentItemsMapper.mapEmptyResponse(yield this.putResponseAsync(url, {}, {}, config)); }); } uploadAssetFromUrlAsync(uploadBinaryFileUrl, addAssetUrl, data, config) { const _super = Object.create(null, { getBinaryDataFromUrlAsync: { get: () => super.getBinaryDataFromUrlAsync }, getMimeTypeFromFilename: { get: () => super.getMimeTypeFromFilename } }); return __awaiter(this, void 0, void 0, function* () { // get binary data from url const binaryData = yield _super.getBinaryDataFromUrlAsync.call(this, data.fileUrl); const mimeType = _super.getMimeTypeFromFilename.call(this, data.binaryFile.filename); if (!mimeType) { throw Error(`Could not get MIME type for filename '${data.binaryFile.filename}'. Please include extension in your filename (e.g. myfile.png)`); } // config needs to be cloned as otherwise it would be mutated with invalid // headers in uploadBinaryFile method const configForUploadBinaryFile = JSON.parse(JSON.stringify(config)); // upload binary file const uploadedBinaryFileResponse = yield this.uploadBinaryFileAsync(uploadBinaryFileUrl, { binaryData: binaryData, contentType: mimeType, filename: data.binaryFile.filename, contentLength: binaryData.byteLength }, configForUploadBinaryFile); // creta asset & assign it to binary file const assetResponse = yield this.addAssetAsync(addAssetUrl, { file_reference: { id: uploadedBinaryFileResponse.data.id, type: uploadedBinaryFileResponse.data.type }, descriptions: data.asset.descriptions, external_id: data.asset.external_id, folder: data.asset.folder, title: data.asset.title, codename: data.asset.codename, collection: data.asset.collection, elements: data.asset.elements }, config); return assetResponse; }); } uploadBinaryFileAsync(url, data, config) { return __awaiter(this, void 0, void 0, function* () { config.headers.push({ header: 'Content-type', value: data.contentType }); if (data.contentLength) { config.headers.push({ header: 'Content-length', value: data.contentLength.toString() }); } return assetsMapper.mapUploadBinaryFileResponse(yield this.postResponseAsync(url, data.binaryData, {}, config)); }); } viewAssetAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return assetsMapper.mapViewAssetResponse(yield this.getResponseAsync(url, {}, config)); }); } listAssetsAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return assetsMapper.mapListingAssetsResponse(yield this.getResponseAsync(url, {}, config)); }); } listContentItemsAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return contentItemsMapper.mapListingItemsResponse(yield this.getResponseAsync(url, {}, config)); }); } viewContentItemAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return contentItemsMapper.mapViewContentItemResponse(yield this.getResponseAsync(url, {}, config)); }); } addContentItemAsync(url, data, config) { return __awaiter(this, void 0, void 0, function* () { return contentItemsMapper.mapAddContentItemResponse(yield this.postResponseAsync(url, data, {}, config)); }); } upsertContentItemAsync(url, data, config) { return __awaiter(this, void 0, void 0, function* () { return contentItemsMapper.mapUpsertContentItemResponse(yield this.putResponseAsync(url, data, {}, config)); }); } updateContentItemAsync(url, data, config) { return __awaiter(this, void 0, void 0, function* () { return contentItemsMapper.mapUpdateContentItemResponse(yield this.putResponseAsync(url, data, {}, config)); }); } deleteContentItemAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return contentItemsMapper.mapEmptyResponse(yield this.deleteResponseAsync(url, {}, config)); }); } deleteLanguageVariantAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return contentItemsMapper.mapEmptyResponse(yield this.deleteResponseAsync(url, {}, config)); }); } upsertLanguageVariantAsync(url, data, config) { return __awaiter(this, void 0, void 0, function* () { return languageVariantMapper.mapUpsertLanguageVariantResponse(yield this.putResponseAsync(url, data, {}, config)); }); } viewLanguageVariantAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return languageVariantMapper.mapViewLanguageVariantResponse(yield this.getResponseAsync(url, {}, config)); }); } listLanguageVariantsOfItemAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return languageVariantMapper.mapLanguageVariantsOfItemResponse(yield this.getResponseAsync(url, {}, config)); }); } listLanguageVariantsOfContentTypeWithComponentsAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return languageVariantMapper.mapLanguageVariantsOfContentTypeWithComponentsResponse(yield this.getResponseAsync(url, {}, config)); }); } listLanguageVariantsOfContentTypeAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return languageVariantMapper.mapLanguageVariantsOfContentTypeResponse(yield this.getResponseAsync(url, {}, config)); }); } listLanguageVariantsByCollectionAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return languageVariantMapper.mapLanguageVariantsByCollectionResponse(yield this.getResponseAsync(url, {}, config)); }); } listLanguageVariantsBySpaceAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return languageVariantMapper.mapLanguageVariantsBySpaceResponse(yield this.getResponseAsync(url, {}, config)); }); } listLanguagesAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return languageMapper.mapListLanguagesResponse(yield this.getResponseAsync(url, {}, config)); }); } viewLanguageAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return languageMapper.mapViewLanguageResponse(yield this.getResponseAsync(url, {}, config)); }); } addLanguageAsync(url, config, data) { return __awaiter(this, void 0, void 0, function* () { return languageMapper.mapAddLanguageResponse(yield this.postResponseAsync(url, data, {}, config)); }); } modifyLanguageAsync(url, config, data) { return __awaiter(this, void 0, void 0, function* () { return languageMapper.mapModifyLanguageResponse(yield this.patchResponseAsync(url, data, {}, config)); }); } listWebhooksAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return webhookMapper.mapWebhooksListResponse(yield this.getResponseAsync(url, {}, config)); }); } listLegacyWebhooksAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return webhookMapper.mapLegacyWebhooksListResponse(yield this.getResponseAsync(url, {}, config)); }); } getWebhookAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return webhookMapper.mapGetWebhookResponse(yield this.getResponseAsync(url, {}, config)); }); } getLegacyWebhookAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return webhookMapper.mapGetLegacyWebhookResponse(yield this.getResponseAsync(url, {}, config)); }); } addWebhookAsync(url, config, data) { return __awaiter(this, void 0, void 0, function* () { return webhookMapper.mapAddWebhookResponse(yield this.postResponseAsync(url, data, {}, config)); }); } addLegacyWebhookAsync(url, config, data) { return __awaiter(this, void 0, void 0, function* () { return webhookMapper.mapAddLegacyWebhookResponse(yield this.postResponseAsync(url, data, {}, config)); }); } enableWebhookAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return webhookMapper.mapEmptyResponse(yield this.putResponseAsync(url, {}, {}, config)); }); } disableWebhookAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return webhookMapper.mapEmptyResponse(yield this.putResponseAsync(url, {}, {}, config)); }); } deleteWebhookAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return webhookMapper.mapEmptyResponse(yield this.deleteResponseAsync(url, {}, config)); }); } listAssetFoldersAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return assetFolderMapper.mapListAssetFoldersResponse(yield this.getResponseAsync(url, {}, config)); }); } addAssetFoldersAsync(url, config, data) { return __awaiter(this, void 0, void 0, function* () { return assetFolderMapper.mapAddAssetFoldersResponse(yield this.postResponseAsync(url, data, {}, config)); }); } modifyAssetFoldersAsync(url, config, data) { return __awaiter(this, void 0, void 0, function* () { return assetFolderMapper.mapModifyAssetFoldersResponse(yield this.patchResponseAsync(url, data, {}, config)); }); } listCollectionsAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return collectionsMappers.mapListCollectionsResponse(yield this.getResponseAsync(url, {}, config)); }); } listRolesAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return roleMapper.mapRoleListResponse(yield this.getResponseAsync(url, {}, config)); }); } viewRoleAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return roleMapper.mapViewRoleResponse(yield this.getResponseAsync(url, {}, config)); }); } getPreviewConfigurationAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return previewMapper.mapPreviewConfigurationResponse(yield this.getResponseAsync(url, {}, config)); }); } modifyPreviewConfigurationAsync(url, config, data) { return __awaiter(this, void 0, void 0, function* () { return previewMapper.mapModifyConfigurationResponse(yield this.putResponseAsync(url, data, {}, config)); }); } setCollectionsAsync(url, config, data) { return __awaiter(this, void 0, void 0, function* () { return collectionsMappers.mapSetCollectionsResponse(yield this.patchResponseAsync(url, data, {}, config)); }); } inviteProjectUserAsync(url, config, data) { return __awaiter(this, void 0, void 0, function* () { return projectUserMapper.mapInviteUserResponse(yield this.postResponseAsync(url, data, {}, config)); }); } changeUserRolesAsync(url, config, data) { return __awaiter(this, void 0, void 0, function* () { return projectUserMapper.mapChangeUserRolesResponse(yield this.putResponseAsync(url, data, {}, config)); }); } getEnvironmentCloningStateAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return environmentMapper.mapGetEnvironmentCloningStateResponse(yield this.getResponseAsync(url, {}, config)); }); } deleteEnvironmentAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return environmentMapper.mapEmptyResponse(yield this.deleteResponseAsync(url, {}, config)); }); } modifyEnvironmentAsync(url, config, data) { return __awaiter(this, void 0, void 0, function* () { return environmentMapper.mapModifyEnvironmentResponse(yield this.patchResponseAsync(url, data, {}, config)); }); } cloneEnvironmentAsync(url, config, data) { return __awaiter(this, void 0, void 0, function* () { return environmentMapper.mapCloneEnvironmentResponse(yield this.postResponseAsync(url, data, {}, config)); }); } markEnvironmentAsProductionAsync(url, config, data) { return __awaiter(this, void 0, void 0, function* () { return environmentMapper.mapEmptyResponse(yield this.putResponseAsync(url, data, {}, config)); }); } addSpaceAsync(url, data, config) { return __awaiter(this, void 0, void 0, function* () { return spacesMapper.mapAddSpaceResponse(yield this.postResponseAsync(url, data, {}, config)); }); } viewSpaceAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return spacesMapper.mapViewSpaceResponse(yield this.getResponseAsync(url, {}, config)); }); } listSpacesAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return spacesMapper.mapListingSpacesResponse(yield this.getResponseAsync(url, {}, config)); }); } deleteSpaceAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return spacesMapper.mapEmptyResponse(yield this.deleteResponseAsync(url, {}, config)); }); } modifySpaceAsync(url, config, data) { return __awaiter(this, void 0, void 0, function* () { return spacesMapper.mapModifySpaceResponse(yield this.patchResponseAsync(url, data, {}, config)); }); } activateWebSpotlightAsync(url, config, data) { return __awaiter(this, void 0, void 0, function* () { return webSpotlightMapper.mapWebSpotlightStatusResponse(yield this.putResponseAsync(url, data, {}, config)); }); } deactivateWebSpotlightAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return webSpotlightMapper.mapWebSpotlightStatusResponse(yield this.putResponseAsync(url, {}, {}, config)); }); } checkWebSpotlightStatusAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return webSpotlightMapper.mapWebSpotlightStatusResponse(yield this.getResponseAsync(url, {}, config)); }); } getListAllResponseInternalAsync(data) { var _a, _b; return __awaiter(this, void 0, void 0, function* () { const response = yield data.getResponse(data.xContinuationToken); if ((_a = data.listQueryConfig) === null || _a === void 0 ? void 0 : _a.delayBetweenRequests) { yield this.sleepAsync(data.listQueryConfig.delayBetweenRequests); } data.resolvedResponses.push(response); if ((_b = data.listQueryConfig) === null || _b === void 0 ? void 0 : _b.responseFetched) { data.listQueryConfig.responseFetched(response, data.xContinuationToken); } if (response.data.pagination.continuationToken) { // recursively fetch next page data return yield this.getListAllResponseInternalAsync({ xContinuationToken: response.data.pagination.continuationToken, getResponse: data.getResponse, resolvedResponses: data.resolvedResponses, listQueryConfig: data.listQueryConfig }); } return data.resolvedResponses; }); } sleepAsync(ms) { return __awaiter(this, void 0, void 0, function* () { return yield new Promise((resolve) => setTimeout(resolve, ms)); }); } } //# sourceMappingURL=management-query-service.class.js.map