import type { BasicCursorPaginationOptions, MakeRequest } from './common-types'; import type { EnvironmentTemplateProps } from './entities/environment-template'; import type { CreateEnvironmentTemplateInstallationProps, ValidateEnvironmentTemplateInstallationProps } from './entities/environment-template-installation'; export type ContentfulEnvironmentTemplateApi = ReturnType; export declare function createEnvironmentTemplateApi(makeRequest: MakeRequest, organizationId: string): { /** * Updates a environment template * @return Promise for new version of the template * ```javascript * const contentful = require('contentful-management') * * const client = contentful.createClient({ * accessToken: '' * }) * * client.getEnvironmentTemplate('', '') * .then((environmentTemplate) => { * environmentTemplate.name = 'New name' * return environmentTemplate.update() * }) * .then((environmentTemplate) => * console.log(`Environment template ${environmentTemplate.sys.id} renamed.`) * ).catch(console.error) * ``` */ update: () => Promise; /** * Updates environment template version data * @param version.versionName - Name of the environment template version * @param version.versionDescription - Description of the environment template version * @return Promise for an updated EnvironmentTemplate * ```javascript * const contentful = require('contentful-management') * * const client = contentful.createClient({ * accessToken: '' * }) * * client.getEnvironmentTemplate('', '') * .then((environmentTemplate) => { * return environmentTemplate.updateVersion({ * versionName: 'New Name', * versionDescription: 'New Description', * }) * }) * .then((environmentTemplate) => * console.log(`Environment template version ${environmentTemplate.sys.id} renamed.`) * ).catch(console.error) * ``` */ updateVersion: ({ versionName, versionDescription, }: { versionName: string; versionDescription: string; }) => Promise; /** * Deletes the environment template * @return Promise for the deletion. It contains no data, but the Promise error case should be handled. * @example ```javascript * const contentful = require('contentful-management') * * const client = contentful.createClient({ * accessToken: '' * }) * * client.getEnvironmentTemplate('', '') * .then((environmentTemplate) => environmentTemplate.delete()) * .then(() => console.log('Environment template deleted.')) * .catch(console.error) * ``` */ delete: () => Promise; /** * Gets a collection of all versions for the environment template * @return Promise for a EnvironmentTemplate * ```javascript * const contentful = require('contentful-management') * * const client = contentful.createClient({ * accessToken: '' * }) * client.getEnvironmentTemplate('', '') * .then((environmentTemplate) => environmentTemplate.getVersions()) * .then((environmentTemplateVersions) => console.log(environmentTemplateVersions.items)) * .catch(console.error) * ``` */ getVersions: () => Promise>; /** * Gets a collection of all installations for the environment template * @param [installationParams.spaceId] - Space ID to filter installations by space and environment * @param [installationParams.environmentId] - Environment ID to filter installations by space and environment * @return Promise for a collection of EnvironmentTemplateInstallations * ```javascript * const contentful = require('contentful-management') * * const client = contentful.createClient({ * accessToken: '' * }) * * client.getEnvironmentTemplate('', '') * .then((environmentTemplate) => environmentTemplate.getInstallations()) * .then((environmentTemplateInstallations) => * console.log(environmentTemplateInstallations.items) * ) * .catch(console.error) * ``` */ getInstallations: ({ spaceId, environmentId, ...query }?: { spaceId?: string; environmentId?: string; } & BasicCursorPaginationOptions) => Promise>; /** * Validates an environment template against a given space and environment * @param params.spaceId - Space ID where the template should be installed into * @param params.environmentId - Environment ID where the template should be installed into * @param [params.version] - Version of the template * @param [params.installation.takeover] - Already existing Content types to takeover in the target environment * @param [params.changeSet] - Change set which should be applied * @return Promise for a EnvironmentTemplateValidation * ```javascript * const contentful = require('contentful-management') * * const client = contentful.createClient({ * accessToken: '' * }) * * client.getEnvironmentTemplate('', '') * .then((environmentTemplate) => environmentTemplate.validate({ * spaceId: '', * environmentId: '', * version: , * })) * .then((validationResult) => console.log(validationResult)) * .catch(console.error) * ``` */ validate: ({ spaceId, environmentId, version, takeover, changeSet, }: { spaceId: string; environmentId: string; version?: number; } & ValidateEnvironmentTemplateInstallationProps) => Promise; /** * Installs a template against a given space and environment * @param params.spaceId - Space ID where the template should be installed into * @param params.environmentId - Environment ID where the template should be installed into * @param params.installation.version- Template version which should be installed * @param [params.installation.takeover] - Already existing Content types tp takeover in the target environment * @param [params.changeSet] - Change set which should be applied * @return Promise for a EnvironmentTemplateInstallation * ```javascript * const contentful = require('contentful-management') * * const client = contentful.createClient({ * accessToken: '' * }) * * client.getEnvironmentTemplate('', '') * .then((environmentTemplate) => environmentTemplate.validate({ * spaceId: '', * environmentId: '', * installation: { * version: , * } * })) * .then((installation) => console.log(installation)) * .catch(console.error) * ``` */ install: ({ spaceId, environmentId, installation, }: { spaceId: string; environmentId: string; installation: CreateEnvironmentTemplateInstallationProps; }) => Promise; /** * Disconnects the template from a given environment * @param params.spaceId - Space ID where the template should be installed into * @param params.environmentId - Environment ID where the template should be installed into * @return Promise for the disconnection with no data * ```javascript * const contentful = require('contentful-management') * * const client = contentful.createClient({ * accessToken: '' * }) * * client.getEnvironmentTemplate('', '') * .then(environmentTemplate) => environmentTemplate.disconnected()) * .then(() => console.log('Template disconnected')) * .catch(console.error) * ``` */ disconnect: ({ spaceId, environmentId, }: { spaceId: string; environmentId: string; }) => Promise; };