UNPKG

@kontent-ai/management-sdk

Version:
663 lines 33.1 kB
"use strict"; 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()); }); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.ManagementQueryService = void 0; const mappers_1 = require("../mappers"); const webhook_mapper_1 = require("../mappers/webhook-mapper"); const base_management_service_class_1 = require("./base-management-service.class"); class ManagementQueryService extends base_management_service_class_1.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 mappers_1.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 mappers_1.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 mappers_1.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 mappers_1.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 mappers_1.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 mappers_1.workflowMapper.mapEmptyResponse(yield this.putResponseAsync(url, data, {}, config)); }); } createNewVersionOfLanguageVariantAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return mappers_1.workflowMapper.mapEmptyResponse(yield this.putResponseAsync(url, undefined, {}, config)); }); } unpublishLanguageVariantAsync(url, data, config) { return __awaiter(this, void 0, void 0, function* () { return mappers_1.workflowMapper.mapEmptyResponse(yield this.putResponseAsync(url, data, {}, config)); }); } cancelScheduledPublishingOfLanguageVariantAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return mappers_1.workflowMapper.mapEmptyResponse(yield this.putResponseAsync(url, undefined, {}, config)); }); } cancelScheduledUnpublishingOfLanguageVariantAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return mappers_1.workflowMapper.mapEmptyResponse(yield this.putResponseAsync(url, undefined, {}, config)); }); } changeWorkflowOfLanguageVariantAsync(url, data, config) { return __awaiter(this, void 0, void 0, function* () { return mappers_1.workflowMapper.mapEmptyResponse(yield this.putResponseAsync(url, data, {}, config)); }); } listWorkflowsAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return mappers_1.workflowMapper.mapListWorkflowsResponse(yield this.getResponseAsync(url, {}, config)); }); } addWorkflowAsync(url, config, data) { return __awaiter(this, void 0, void 0, function* () { return mappers_1.workflowMapper.mapAddWorkflowResponse(yield this.postResponseAsync(url, data, {}, config)); }); } updateWorkflowAsync(url, config, data) { return __awaiter(this, void 0, void 0, function* () { return mappers_1.workflowMapper.mapUpdateWorkflowResponse(yield this.putResponseAsync(url, data, {}, config)); }); } deleteWorkflowAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return webhook_mapper_1.webhookMapper.mapEmptyResponse(yield this.deleteResponseAsync(url, {}, config)); }); } viewContentTypeSnippetAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return mappers_1.contentTypeSnippetMapper.mapViewContentTypeSnippetResponse(yield this.getResponseAsync(url, {}, config)); }); } deleteContentTypeSnippetAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return mappers_1.contentTypeSnippetMapper.mapEmptyResponse(yield this.deleteResponseAsync(url, {}, config)); }); } addContentTypeSnippetAsync(url, data, config) { return __awaiter(this, void 0, void 0, function* () { return mappers_1.contentTypeSnippetMapper.mapAddContentTypeSnippetResponse(yield this.postResponseAsync(url, data, {}, config)); }); } listContentTypeSnippetsAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return mappers_1.contentTypeSnippetMapper.mapListingResponse(yield this.getResponseAsync(url, {}, config)); }); } environmentInformationAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return mappers_1.environmentMapper.mapEnvironmentInformationResponse(yield this.getResponseAsync(url, {}, config)); }); } listEnvironmentValidationIssuesAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return mappers_1.environmentMapper.mapProjectValidationIssuesListResponse(yield this.getResponseAsync(url, {}, config)); }); } startEnvironmentValidationAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return mappers_1.environmentMapper.mapStartEnvironmentValidationResponse(yield this.postResponseAsync(url, {}, {}, config)); }); } checkEnvironmentValidationAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return mappers_1.environmentMapper.mapCheckEnvironmentValidationResponse(yield this.getResponseAsync(url, {}, config)); }); } addContentTypeAsync(url, data, config) { return __awaiter(this, void 0, void 0, function* () { return mappers_1.contentTypeMapper.mapAddContentTypeResponse(yield this.postResponseAsync(url, data, {}, config)); }); } deleteContentTypeAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return mappers_1.contentTypeMapper.mapEmptyResponse(yield this.deleteResponseAsync(url, {}, config)); }); } modifyContentTypeAsync(url, config, data) { return __awaiter(this, void 0, void 0, function* () { return mappers_1.contentTypeMapper.mapModifyContentTypeResponse(yield this.patchResponseAsync(url, data, {}, config)); }); } modifyTaxonomyAsync(url, config, data) { return __awaiter(this, void 0, void 0, function* () { return mappers_1.taxonomyMappper.mapModifyTaxonomyResponse(yield this.patchResponseAsync(url, data, {}, config)); }); } modifyContentTypeSnippetAsync(url, config, data) { return __awaiter(this, void 0, void 0, function* () { return mappers_1.contentTypeSnippetMapper.mapModifyContentTypeSnippetResponse(yield this.patchResponseAsync(url, data, {}, config)); }); } viewContentTypeAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return mappers_1.contentTypeMapper.mapViewContentTypeResponse(yield this.getResponseAsync(url, {}, config)); }); } listContentTypesAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return mappers_1.contentTypeMapper.mapListingResponse(yield this.getResponseAsync(url, {}, config)); }); } listAssetRenditionsAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return mappers_1.assetRenditionMapper.mapListAssetRenditionsResponse(yield this.getResponseAsync(url, {}, config)); }); } viewAssetRenditionAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return mappers_1.assetRenditionMapper.mapViewAssetRenditionResponse(yield this.getResponseAsync(url, {}, config)); }); } addAssetRenditionAsync(url, config, data) { return __awaiter(this, void 0, void 0, function* () { return mappers_1.assetRenditionMapper.mapAddAssetRenditionResponse(yield this.postResponseAsync(url, data, {}, config)); }); } modifyAssetRenditionAsync(url, config, data) { return __awaiter(this, void 0, void 0, function* () { return mappers_1.assetRenditionMapper.mapModifyAssetRenditionResponse(yield this.putResponseAsync(url, data, {}, config)); }); } addCustomAppAsync(url, data, config) { return __awaiter(this, void 0, void 0, function* () { return mappers_1.customAppMapper.mapAddCustomAppResponse(yield this.postResponseAsync(url, data, {}, config)); }); } modifyCustomAppAsync(url, data, config) { return __awaiter(this, void 0, void 0, function* () { return mappers_1.customAppMapper.mapModifyCustomAppResponse(yield this.patchResponseAsync(url, data, {}, config)); }); } deleteCustomAppAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return mappers_1.customAppMapper.mapEmptyResponse(yield this.deleteResponseAsync(url, {}, config)); }); } getCustomAppAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return mappers_1.customAppMapper.mapGetCustomAppResponse(yield this.getResponseAsync(url, {}, config)); }); } listCustomAppsAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return mappers_1.customAppMapper.mapListCustomAppsResponse(yield this.getResponseAsync(url, {}, config)); }); } addTaxonomyAsync(url, data, config) { return __awaiter(this, void 0, void 0, function* () { return mappers_1.taxonomyMappper.mapAddTaxonomyResponse(yield this.postResponseAsync(url, data, {}, config)); }); } deleteTaxonomyAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return mappers_1.taxonomyMappper.mapEmptyResponse(yield this.deleteResponseAsync(url, {}, config)); }); } getTaxonomyAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return mappers_1.taxonomyMappper.mapGetTaxonomyResponse(yield this.getResponseAsync(url, {}, config)); }); } listTaxonomiesAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return mappers_1.taxonomyMappper.mapListingTaxonomysResponse(yield this.getResponseAsync(url, {}, config)); }); } deleteAssetAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return mappers_1.assetsMapper.mapEmptyResponse(yield this.deleteResponseAsync(url, {}, config)); }); } upsertAssetAsync(url, data, config) { return __awaiter(this, void 0, void 0, function* () { return mappers_1.assetsMapper.mapUpsertAssetResponse(yield this.putResponseAsync(url, data, {}, config)); }); } addAssetAsync(url, data, config) { return __awaiter(this, void 0, void 0, function* () { return mappers_1.assetsMapper.mapAddAssetResponse(yield this.postResponseAsync(url, data, {}, config)); }); } listSubscriptionProjectsAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return mappers_1.subscriptionMapper.mapSubscriptionProjectsListResponse(yield this.getResponseAsync(url, {}, config)); }); } litSubscriptionUsersAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return mappers_1.subscriptionMapper.mapSubscriptionUsersListResponse(yield this.getResponseAsync(url, {}, config)); }); } viewSubscriptionProjectAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return mappers_1.subscriptionMapper.mapViewSubscriptionProjectResponse(yield this.getResponseAsync(url, {}, config)); }); } viewSubscriptionUserAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return mappers_1.subscriptionMapper.mapViewSubscriptionUserResponse(yield this.getResponseAsync(url, {}, config)); }); } activateUserInAllProjectsAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return mappers_1.contentItemsMapper.mapEmptyResponse(yield this.putResponseAsync(url, {}, {}, config)); }); } deactivateUserInAllProjectsAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return mappers_1.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 mappers_1.assetsMapper.mapUploadBinaryFileResponse(yield this.postResponseAsync(url, data.binaryData, {}, config)); }); } viewAssetAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return mappers_1.assetsMapper.mapViewAssetResponse(yield this.getResponseAsync(url, {}, config)); }); } listAssetsAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return mappers_1.assetsMapper.mapListingAssetsResponse(yield this.getResponseAsync(url, {}, config)); }); } listContentItemsAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return mappers_1.contentItemsMapper.mapListingItemsResponse(yield this.getResponseAsync(url, {}, config)); }); } viewContentItemAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return mappers_1.contentItemsMapper.mapViewContentItemResponse(yield this.getResponseAsync(url, {}, config)); }); } addContentItemAsync(url, data, config) { return __awaiter(this, void 0, void 0, function* () { return mappers_1.contentItemsMapper.mapAddContentItemResponse(yield this.postResponseAsync(url, data, {}, config)); }); } upsertContentItemAsync(url, data, config) { return __awaiter(this, void 0, void 0, function* () { return mappers_1.contentItemsMapper.mapUpsertContentItemResponse(yield this.putResponseAsync(url, data, {}, config)); }); } updateContentItemAsync(url, data, config) { return __awaiter(this, void 0, void 0, function* () { return mappers_1.contentItemsMapper.mapUpdateContentItemResponse(yield this.putResponseAsync(url, data, {}, config)); }); } deleteContentItemAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return mappers_1.contentItemsMapper.mapEmptyResponse(yield this.deleteResponseAsync(url, {}, config)); }); } deleteLanguageVariantAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return mappers_1.contentItemsMapper.mapEmptyResponse(yield this.deleteResponseAsync(url, {}, config)); }); } upsertLanguageVariantAsync(url, data, config) { return __awaiter(this, void 0, void 0, function* () { return mappers_1.languageVariantMapper.mapUpsertLanguageVariantResponse(yield this.putResponseAsync(url, data, {}, config)); }); } viewLanguageVariantAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return mappers_1.languageVariantMapper.mapViewLanguageVariantResponse(yield this.getResponseAsync(url, {}, config)); }); } listLanguageVariantsOfItemAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return mappers_1.languageVariantMapper.mapLanguageVariantsOfItemResponse(yield this.getResponseAsync(url, {}, config)); }); } listLanguageVariantsOfContentTypeWithComponentsAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return mappers_1.languageVariantMapper.mapLanguageVariantsOfContentTypeWithComponentsResponse(yield this.getResponseAsync(url, {}, config)); }); } listLanguageVariantsOfContentTypeAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return mappers_1.languageVariantMapper.mapLanguageVariantsOfContentTypeResponse(yield this.getResponseAsync(url, {}, config)); }); } listLanguageVariantsByCollectionAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return mappers_1.languageVariantMapper.mapLanguageVariantsByCollectionResponse(yield this.getResponseAsync(url, {}, config)); }); } filterItemsWithVariantsAsync(url, data, config) { return __awaiter(this, void 0, void 0, function* () { return mappers_1.languageVariantMapper.mapFilterItemsWithVariantsResponse(yield this.postResponseAsync(url, data, {}, config)); }); } bulkGetItemsWithVariantsAsync(url, data, config) { return __awaiter(this, void 0, void 0, function* () { return mappers_1.languageVariantMapper.mapBulkGetItemsWithVariantsResponse(yield this.postResponseAsync(url, data, {}, config)); }); } listLanguageVariantsBySpaceAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return mappers_1.languageVariantMapper.mapLanguageVariantsBySpaceResponse(yield this.getResponseAsync(url, {}, config)); }); } listLanguagesAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return mappers_1.languageMapper.mapListLanguagesResponse(yield this.getResponseAsync(url, {}, config)); }); } viewLanguageAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return mappers_1.languageMapper.mapViewLanguageResponse(yield this.getResponseAsync(url, {}, config)); }); } addLanguageAsync(url, config, data) { return __awaiter(this, void 0, void 0, function* () { return mappers_1.languageMapper.mapAddLanguageResponse(yield this.postResponseAsync(url, data, {}, config)); }); } modifyLanguageAsync(url, config, data) { return __awaiter(this, void 0, void 0, function* () { return mappers_1.languageMapper.mapModifyLanguageResponse(yield this.patchResponseAsync(url, data, {}, config)); }); } listWebhooksAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return webhook_mapper_1.webhookMapper.mapWebhooksListResponse(yield this.getResponseAsync(url, {}, config)); }); } getWebhookAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return webhook_mapper_1.webhookMapper.mapGetWebhookResponse(yield this.getResponseAsync(url, {}, config)); }); } addWebhookAsync(url, config, data) { return __awaiter(this, void 0, void 0, function* () { return webhook_mapper_1.webhookMapper.mapAddWebhookResponse(yield this.postResponseAsync(url, data, {}, config)); }); } enableWebhookAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return webhook_mapper_1.webhookMapper.mapEmptyResponse(yield this.putResponseAsync(url, {}, {}, config)); }); } disableWebhookAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return webhook_mapper_1.webhookMapper.mapEmptyResponse(yield this.putResponseAsync(url, {}, {}, config)); }); } deleteWebhookAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return webhook_mapper_1.webhookMapper.mapEmptyResponse(yield this.deleteResponseAsync(url, {}, config)); }); } listAssetFoldersAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return mappers_1.assetFolderMapper.mapListAssetFoldersResponse(yield this.getResponseAsync(url, {}, config)); }); } addAssetFoldersAsync(url, config, data) { return __awaiter(this, void 0, void 0, function* () { return mappers_1.assetFolderMapper.mapAddAssetFoldersResponse(yield this.postResponseAsync(url, data, {}, config)); }); } modifyAssetFoldersAsync(url, config, data) { return __awaiter(this, void 0, void 0, function* () { return mappers_1.assetFolderMapper.mapModifyAssetFoldersResponse(yield this.patchResponseAsync(url, data, {}, config)); }); } listCollectionsAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return mappers_1.collectionsMappers.mapListCollectionsResponse(yield this.getResponseAsync(url, {}, config)); }); } listRolesAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return mappers_1.roleMapper.mapRoleListResponse(yield this.getResponseAsync(url, {}, config)); }); } viewRoleAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return mappers_1.roleMapper.mapViewRoleResponse(yield this.getResponseAsync(url, {}, config)); }); } getPreviewConfigurationAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return mappers_1.previewMapper.mapPreviewConfigurationResponse(yield this.getResponseAsync(url, {}, config)); }); } modifyPreviewConfigurationAsync(url, config, data) { return __awaiter(this, void 0, void 0, function* () { return mappers_1.previewMapper.mapModifyConfigurationResponse(yield this.putResponseAsync(url, data, {}, config)); }); } getLivePreviewConfigurationAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return mappers_1.previewMapper.mapLivePreviewConfigurationResponse(yield this.getResponseAsync(url, {}, config)); }); } changeLivePreviewConfigurationAsync(url, config, data) { return __awaiter(this, void 0, void 0, function* () { return mappers_1.previewMapper.mapChangeLivePreviewConfigurationResponse(yield this.putResponseAsync(url, data, {}, config)); }); } setCollectionsAsync(url, config, data) { return __awaiter(this, void 0, void 0, function* () { return mappers_1.collectionsMappers.mapSetCollectionsResponse(yield this.patchResponseAsync(url, data, {}, config)); }); } inviteProjectUserAsync(url, config, data) { return __awaiter(this, void 0, void 0, function* () { return mappers_1.projectUserMapper.mapInviteUserResponse(yield this.postResponseAsync(url, data, {}, config)); }); } changeUserRolesAsync(url, config, data) { return __awaiter(this, void 0, void 0, function* () { return mappers_1.projectUserMapper.mapChangeUserRolesResponse(yield this.putResponseAsync(url, data, {}, config)); }); } getEnvironmentCloningStateAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return mappers_1.environmentMapper.mapGetEnvironmentCloningStateResponse(yield this.getResponseAsync(url, {}, config)); }); } deleteEnvironmentAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return mappers_1.environmentMapper.mapEmptyResponse(yield this.deleteResponseAsync(url, {}, config)); }); } modifyEnvironmentAsync(url, config, data) { return __awaiter(this, void 0, void 0, function* () { return mappers_1.environmentMapper.mapModifyEnvironmentResponse(yield this.patchResponseAsync(url, data, {}, config)); }); } cloneEnvironmentAsync(url, config, data) { return __awaiter(this, void 0, void 0, function* () { return mappers_1.environmentMapper.mapCloneEnvironmentResponse(yield this.postResponseAsync(url, data, {}, config)); }); } markEnvironmentAsProductionAsync(url, config, data) { return __awaiter(this, void 0, void 0, function* () { return mappers_1.environmentMapper.mapEmptyResponse(yield this.putResponseAsync(url, data, {}, config)); }); } addSpaceAsync(url, data, config) { return __awaiter(this, void 0, void 0, function* () { return mappers_1.spacesMapper.mapAddSpaceResponse(yield this.postResponseAsync(url, data, {}, config)); }); } viewSpaceAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return mappers_1.spacesMapper.mapViewSpaceResponse(yield this.getResponseAsync(url, {}, config)); }); } listSpacesAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return mappers_1.spacesMapper.mapListingSpacesResponse(yield this.getResponseAsync(url, {}, config)); }); } deleteSpaceAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return mappers_1.spacesMapper.mapEmptyResponse(yield this.deleteResponseAsync(url, {}, config)); }); } modifySpaceAsync(url, config, data) { return __awaiter(this, void 0, void 0, function* () { return mappers_1.spacesMapper.mapModifySpaceResponse(yield this.patchResponseAsync(url, data, {}, config)); }); } activateWebSpotlightAsync(url, config, data) { return __awaiter(this, void 0, void 0, function* () { return mappers_1.webSpotlightMapper.mapWebSpotlightStatusResponse(yield this.putResponseAsync(url, data, {}, config)); }); } deactivateWebSpotlightAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return mappers_1.webSpotlightMapper.mapWebSpotlightStatusResponse(yield this.putResponseAsync(url, {}, {}, config)); }); } checkWebSpotlightStatusAsync(url, config) { return __awaiter(this, void 0, void 0, function* () { return mappers_1.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)); }); } } exports.ManagementQueryService = ManagementQueryService; //# sourceMappingURL=management-query-service.class.js.map