import { Stream } from 'stream'; import type { QueryOptions } from './common-types'; import { BasicQueryOptions, MakeRequest } from './common-types'; import type { CreateAppInstallationProps } from './entities/app-installation'; import type { CreateAppSignedRequestProps } from './entities/app-signed-request'; import type { AssetFileProp, AssetProps, CreateAssetProps } from './entities/asset'; import type { CreateAssetKeyProps } from './entities/asset-key'; import type { BulkAction, BulkActionPayload, BulkActionPublishPayload, BulkActionUnpublishPayload, BulkActionValidatePayload } from './entities/bulk-action'; import { ReleaseActionQueryOptions } from './entities/release-action'; import { ReleasePayload, ReleaseQueryOptions, ReleaseValidatePayload } from './entities/release'; import type { ContentTypeProps, CreateContentTypeProps } from './entities/content-type'; import type { CreateEntryProps, EntryProps, EntryReferenceOptionsProps, EntryReferenceProps } from './entities/entry'; import type { CreateExtensionProps } from './entities/extension'; import type { CreateLocaleProps } from './entities/locale'; import { TagVisibility } from './entities/tag'; /** * @private */ export declare type ContentfulEnvironmentAPI = ReturnType; /** * Creates API object with methods to access the Environment API * @param {ContentfulEnvironmentAPI} makeRequest - function to make requests via an adapter * @return {ContentfulSpaceAPI} * @private */ export default function createEnvironmentApi(makeRequest: MakeRequest): { /** * Deletes the environment * @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.getSpace('') * .then((space) => space.getEnvironment('')) * .then((environment) => environment.delete()) * .then(() => console.log('Environment deleted.')) * .catch(console.error) * ``` */ delete: () => Promise; /** * Updates the environment * @return Promise for the updated environment. * @example ```javascript * const contentful = require('contentful-management') * * const client = contentful.createClient({ * accessToken: '' * }) * * client.getSpace('') * .then((space) => space.getEnvironment('')) * .then((environment) => { * environment.name = 'New name' * return environment.update() * }) * .then((environment) => console.log(`Environment ${environment.sys.id} renamed.`) * .catch(console.error) * ``` */ update: () => Promise; /** * Creates SDK Entry object (locally) from entry data * @param entryData - Entry Data * @return Entry * @example ```javascript * environment.getEntry('entryId').then(entry => { * * // Build a plainObject in order to make it usable for React (saving in state or redux) * const plainObject = entry.toPlainObject(); * * // The entry is being updated in some way as plainObject: * const updatedPlainObject = { * ...plainObject, * fields: { * ...plainObject.fields, * title: { * 'en-US': 'updatedTitle' * } * } * }; * * // Rebuild an sdk object out of the updated plainObject: * const entryWithMethodsAgain = environment.getEntryFromData(updatedPlainObject); * * // Update with help of the sdk method: * entryWithMethodsAgain.update(); * * }); * ``` **/ getEntryFromData(entryData: EntryProps): import("./entities/entry").Entry; /** * Creates SDK Asset object (locally) from entry data * @param assetData - Asset ID * @return Asset * @example ```javascript * environment.getAsset('asset_id').then(asset => { * * // Build a plainObject in order to make it usable for React (saving in state or redux) * const plainObject = asset.toPlainObject(); * * // The asset is being updated in some way as plainObject: * const updatedPlainObject = { * ...plainObject, * fields: { * ...plainObject.fields, * title: { * 'en-US': 'updatedTitle' * } * } * }; * * // Rebuild an sdk object out of the updated plainObject: * const assetWithMethodsAgain = environment.getAssetFromData(updatedPlainObject); * * // Update with help of the sdk method: * assetWithMethodsAgain.update(); * * }); * ``` */ getAssetFromData(assetData: AssetProps): import("./entities/asset").Asset; /** * * @description Get a BulkAction by ID. * See: https://www.contentful.com/developers/docs/references/content-management-api/#/reference/bulk-actions/bulk-action * @param bulkActionId - ID of the BulkAction to fetch * @returns - Promise with the BulkAction * * @example ```javascript * const contentful = require('contentful-management') * * const client = contentful.createClient({ * accessToken: '' * }) * * client.getSpace('') * .then((space) => space.getEnvironment('')) * .then((environment) => environment.getBulkAction('')) * .then((bulkAction) => console.log(bulkAction)) * ``` */ getBulkAction(bulkActionId: string): Promise>; /** * @description Creates a BulkAction that will attempt to publish all items contained in the payload. * See: https://www.contentful.com/developers/docs/references/content-management-api/#/reference/bulk-actions/publish-bulk-action * @param {BulkActionPayload} payload - Object containing the items to be processed in the bulkAction * @returns - Promise with the BulkAction * * @example * * ```javascript * const contentful = require('contentful-management') * * const client = contentful.createClient({ * accessToken: '' * }) * * const payload = { * entities: { * sys: { type: 'Array' } * items: [ * { sys: { type: 'Link', id: '', linkType: 'Entry', version: 2 } } * ] * } * } * * // Using Thenables * client.getSpace('') * .then((space) => space.getEnvironment('')) * .then((environment) => environment.createPublishBulkAction(payload)) * .then((bulkAction) => console.log(bulkAction.waitProcessing())) * .catch(console.error) * * // Using async/await * try { * const space = await client.getSpace('') * const environment = await space.getEnvironment('') * const bulkActionInProgress = await environment.createPublishBulkAction(payload) * * // You can wait for a recently created BulkAction to be processed by using `bulkAction.waitProcessing()` * const bulkActionCompleted = await bulkActionInProgress.waitProcessing() * console.log(bulkActionCompleted) * } catch (error) { * console.log(error) * } * ``` */ createPublishBulkAction(payload: BulkActionPublishPayload): Promise>; /** * @description Creates a BulkAction that will attempt to validate all items contained in the payload. * See: https://www.contentful.com/developers/docs/references/content-management-api/#/reference/bulk-actions/validate-bulk-action * @param {BulkActionPayload} payload - Object containing the items to be processed in the bulkAction * @returns - Promise with the BulkAction * * @example * * ```javascript * const contentful = require('contentful-management') * * const client = contentful.createClient({ * accessToken: '' * }) * * const payload = { * action: 'publish', * entities: { * sys: { type: 'Array' } * items: [ * { sys: { type: 'Link', id: '', linkType: 'Entry' } } * ] * } * } * * // Using Thenables * client.getSpace('') * .then((space) => space.getEnvironment('')) * .then((environment) => environment.createValidateBulkAction(payload)) * .then((bulkAction) => console.log(bulkAction.waitProcessing())) * .catch(console.error) * * // Using async/await * try { * const space = await client.getSpace('') * const environment = await space.getEnvironment('') * const bulkActionInProgress = await environment.createValidateBulkAction(payload) * * // You can wait for a recently created BulkAction to be processed by using `bulkAction.waitProcessing()` * const bulkActionCompleted = await bulkActionInProgress.waitProcessing() * console.log(bulkActionCompleted) * } catch (error) { * console.log(error) * } * ``` */ createValidateBulkAction(payload: BulkActionValidatePayload): Promise>; /** * @description Creates a BulkAction that will attempt to unpublish all items contained in the payload. * See: https://www.contentful.com/developers/docs/references/content-management-api/#/reference/bulk-actions/unpublish-bulk-action * @param {BulkActionPayload} payload - Object containing the items to be processed in the bulkAction * @returns - Promise with the BulkAction * * @example * * ```javascript * const contentful = require('contentful-management') * * const client = contentful.createClient({ * accessToken: '' * }) * * const payload = { * entities: { * sys: { type: 'Array' } * items: [ * { sys: { type: 'Link', id: 'entry-id', linkType: 'Entry' } } * ] * } * } * * // Using Thenables * client.getSpace('') * .then((space) => space.getEnvironment('')) * .then((environment) => environment.createUnpublishBulkAction(payload)) * .then((bulkAction) => console.log(bulkAction.waitProcessing())) * .catch(console.error) * * // Using async/await * try { * const space = await clientgetSpace('') * const environment = await space.getEnvironment('') * const bulkActionInProgress = await environment.createUnpublishBulkAction(payload) * * // You can wait for a recently created BulkAction to be processed by using `bulkAction.waitProcessing()` * const bulkActionCompleted = await bulkActionInProgress.waitProcessing() * console.log(bulkActionCompleted) * } catch (error) { * console.log(error) * } * ``` */ createUnpublishBulkAction(payload: BulkActionUnpublishPayload): Promise>; /** * Gets a Content Type * @param contentTypeId - Content Type ID * @return Promise for a Content Type * @example ```javascript * const contentful = require('contentful-management') * * const client = contentful.createClient({ * accessToken: '' * }) * * client.getSpace('') * .then((space) => space.getEnvironment('')) * .then((environment) => environment.getContentType('')) * .then((contentType) => console.log(contentType)) * .catch(console.error) * ``` */ getContentType(contentTypeId: string): Promise; /** * Gets a collection of Content Types * @param query - Object with search parameters. Check the JS SDK tutorial and the REST API reference for more details. * @return Promise for a collection of Content Types * @example ```javascript * const contentful = require('contentful-management') * * const client = contentful.createClient({ * accessToken: '' * }) * * client.getSpace('') * .then((space) => space.getEnvironment('')) * .then((environment) => environment.getContentTypes()) * .then((response) => console.log(response.items)) * .catch(console.error) * ``` */ getContentTypes(query?: QueryOptions): Promise>; /** * Creates a Content Type * @param data - Object representation of the Content Type to be created * @return Promise for the newly created Content Type * @example ```javascript * const contentful = require('contentful-management') * * const client = contentful.createClient({ * accessToken: '' * }) * * client.getSpace('') * .then((space) => space.getEnvironment('')) * .then((environment) => environment.createContentType({ * name: 'Blog Post', * fields: [ * { * id: 'title', * name: 'Title', * required: true, * localized: false, * type: 'Text' * } * ] * })) * .then((contentType) => console.log(contentType)) * .catch(console.error) * ``` */ createContentType(data: CreateContentTypeProps): Promise; /** * Creates a Content Type with a custom ID * @param contentTypeId - Content Type ID * @param data - Object representation of the Content Type to be created * @return Promise for the newly created Content Type * @example ```javascript * const contentful = require('contentful-management') * * const client = contentful.createClient({ * accessToken: '' * }) * * client.getSpace('') * .then((space) => space.getEnvironment('')) * .then((environment) => environment.createContentTypeWithId('', { * name: 'Blog Post', * fields: [ * { * id: 'title', * name: 'Title', * required: true, * localized: false, * type: 'Text' * } * ] * })) * .then((contentType) => console.log(contentType)) * .catch(console.error) * ``` */ createContentTypeWithId(contentTypeId: string, data: CreateContentTypeProps): Promise; /** * Gets an EditorInterface for a ContentType * @param contentTypeId - Content Type ID * @return Promise for an EditorInterface * @example ```javascript * const contentful = require('contentful-management') * * const client = contentful.createClient({ * accessToken: '' * }) * * client.getSpace('') * .then((space) => space.getEnvironment('')) * .then((environment) => environment.getEditorInterfaceForContentType('')) * .then((EditorInterface) => console.log(EditorInterface)) * .catch(console.error) * ``` */ getEditorInterfaceForContentType(contentTypeId: string): Promise; /** * Gets all EditorInterfaces * @return Promise for a collection of EditorInterface * @example ```javascript * const contentful = require('contentful-management') * * const client = contentful.createClient({ * accessToken: '' * }) * * client.getSpace('') * .then((space) => space.getEnvironment('')) * .then((environment) => environment.getEditorInterfaces()) * .then((response) => console.log(response.items)) * .catch(console.error) * ``` */ getEditorInterfaces(): Promise>; /** * Gets an Entry * Warning: if you are using the select operator, when saving, any field that was not selected will be removed * from your entry in the backend * @param id - Entry ID * @param query - Object with search parameters. In this method it's only useful for `locale`. * @return Promise for an Entry * @example ```javascript * const contentful = require('contentful-management') * * const client = contentful.createClient({ * accessToken: '' * }) * * client.getSpace('') * .then((space) => space.getEnvironment('')) * .then((environment) => environment.getEntry('')) * .then((entry) => console.log(entry)) * .catch(console.error) * ``` */ getEntry(id: string, query?: QueryOptions): Promise; /** * Deletes an Entry of this environement * @param id - Entry ID * @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.getSpace('') * .then((space) => space.getEnvironment('')) * .then((environment) => environment.deleteEntry("4bmLXiuviAZH3jkj5DLRWE")) * .then(() => console.log('Entry deleted.')) * .catch(console.error) * ``` */ deleteEntry(id: string): Promise; /** * Gets a collection of Entries * Warning: if you are using the select operator, when saving, any field that was not selected will be removed * from your entry in the backend * @param query - Object with search parameters. Check the JS SDK tutorial and the REST API reference for more details. * @return Promise for a collection of Entries * @example ```javascript * const contentful = require('contentful-management') * * const client = contentful.createClient({ * accessToken: '' * }) * * client.getSpace('') * .then((space) => space.getEnvironment('')) * .then((environment) => environment.getEntries({'content_type': 'foo'})) // you can add more queries as 'key': 'value' * .then((response) => console.log(response.items)) * .catch(console.error) * ``` */ getEntries(query?: QueryOptions): Promise>>; /** * Creates a Entry * @param contentTypeId - The Content Type ID of the newly created Entry * @param data - Object representation of the Entry to be created * @return Promise for the newly created Entry * @example ```javascript * const contentful = require('contentful-management') * * const client = contentful.createClient({ * accessToken: '' * }) * * client.getSpace('') * .then((space) => space.getEnvironment('')) * .then((environment) => environment.createEntry('', { * fields: { * title: { * 'en-US': 'Entry title' * } * } * })) * .then((entry) => console.log(entry)) * .catch(console.error) * ``` */ createEntry(contentTypeId: string, data: Omit): Promise; /** * Creates a Entry with a custom ID * @param contentTypeId - The Content Type of the newly created Entry * @param id - Entry ID * @param data - Object representation of the Entry to be created * @return Promise for the newly created Entry * @example ```javascript * const contentful = require('contentful-management') * * const client = contentful.createClient({ * accessToken: '' * }) * * // Create entry * client.getSpace('') * .then((space) => space.getEnvironment('')) * .then((environment) => environment.createEntryWithId('', '', { * fields: { * title: { * 'en-US': 'Entry title' * } * } * })) * .then((entry) => console.log(entry)) * .catch(console.error) * ``` */ createEntryWithId(contentTypeId: string, id: string, data: CreateEntryProps): Promise; /** * Get entry references * @param entryId - Entry ID * @param {Object} options.include - Level of the entry descendants from 1 up to 10 maximum * @param {Object} options.maxDepth - alias for `include`. Deprecated, please use `include` * @returns Promise of Entry references * @example ```javascript * const contentful = require('contentful-management'); * * const client = contentful.createClient({ * accessToken: ' * }) * * // Get entry references * client.getSpace('') * .then((space) => space.getEnvironment('')) * .then((environment) => environment.getEntryReferences('', {include: number})) * .then((entry) => console.log(entry.includes)) * // or * .then((environment) => environment.getEntry('')).then((entry) => entry.references({include: number})) * .catch(console.error) * ``` */ getEntryReferences(entryId: string, options?: EntryReferenceOptionsProps | undefined): Promise; /** * Gets an Asset * Warning: if you are using the select operator, when saving, any field that was not selected will be removed * from your entry in the backend * @param id - Asset ID * @param query - Object with search parameters. In this method it's only useful for `locale`. * @return Promise for an Asset * @example ```javascript * const contentful = require('contentful-management') * * const client = contentful.createClient({ * accessToken: '' * }) * * client.getSpace('') * .then((space) => space.getEnvironment('')) * .then((environment) => environment.getAsset('')) * .then((asset) => console.log(asset)) * .catch(console.error) * ``` */ getAsset(id: string, query?: QueryOptions): Promise; /** * Gets a collection of Assets * Warning: if you are using the select operator, when saving, any field that was not selected will be removed * from your entry in the backend * @param query - Object with search parameters. Check the JS SDK tutorial and the REST API reference for more details. * @return Promise for a collection of Assets * @example ```javascript * const contentful = require('contentful-management') * * const client = contentful.createClient({ * accessToken: '' * }) * * client.getSpace('') * .then((space) => space.getEnvironment('')) * .then((environment) => environment.getAssets()) * .then((response) => console.log(response.items)) * .catch(console.error) * ``` */ getAssets(query?: QueryOptions): Promise>; /** * Creates a Asset. After creation, call asset.processForLocale or asset.processForAllLocales to start asset processing. * @param data - Object representation of the Asset to be created. Note that the field object should have an upload property on asset creation, which will be removed and replaced with an url property when processing is finished. * @return Promise for the newly created Asset * @example ```javascript * const client = contentful.createClient({ * accessToken: '' * }) * * // Create asset * client.getSpace('') * .then((space) => space.getEnvironment('')) * .then((environment) => environment.createAsset({ * fields: { * title: { * 'en-US': 'Playsam Streamliner' * }, * file: { * 'en-US': { * contentType: 'image/jpeg', * fileName: 'example.jpeg', * upload: 'https://example.com/example.jpg' * } * } * } * })) * .then((asset) => asset.processForLocale("en-US")) // OR asset.processForAllLocales() * .then((asset) => console.log(asset)) * .catch(console.error) * ``` */ createAsset(data: CreateAssetProps): Promise; /** * Creates a Asset with a custom ID. After creation, call asset.processForLocale or asset.processForAllLocales to start asset processing. * @param id - Asset ID * @param data - Object representation of the Asset to be created. Note that the field object should have an upload property on asset creation, which will be removed and replaced with an url property when processing is finished. * @return Promise for the newly created Asset * @example ```javascript * const client = contentful.createClient({ * accessToken: '' * }) * * // Create asset * client.getSpace('') * .then((space) => space.getEnvironment('')) * .then((environment) => environment.createAssetWithId('', { * title: { * 'en-US': 'Playsam Streamliner' * }, * file: { * 'en-US': { * contentType: 'image/jpeg', * fileName: 'example.jpeg', * upload: 'https://example.com/example.jpg' * } * } * })) * .then((asset) => asset.process()) * .then((asset) => console.log(asset)) * .catch(console.error) * ``` */ createAssetWithId(id: string, data: CreateAssetProps): Promise; /** * Creates a Asset based on files. After creation, call asset.processForLocale or asset.processForAllLocales to start asset processing. * @param data - Object representation of the Asset to be created. Note that the field object should have an uploadFrom property on asset creation, which will be removed and replaced with an url property when processing is finished. * @param data.fields.file.[LOCALE].file - Can be a string, an ArrayBuffer or a Stream. * @return Promise for the newly created Asset * @example ```javascript * const client = contentful.createClient({ * accessToken: '' * }) * * client.getSpace('') * .then((space) => space.getEnvironment('')) * .then((environment) => environment.createAssetFromFiles({ * fields: { * file: { * 'en-US': { * contentType: 'image/jpeg', * fileName: 'filename_english.jpg', * file: createReadStream('path/to/filename_english.jpg') * }, * 'de-DE': { * contentType: 'image/svg+xml', * fileName: 'filename_german.svg', * file: '' * } * } * } * })) * .then((asset) => console.log(asset)) * .catch(console.error) * ``` */ createAssetFromFiles(data: Omit): Promise; /** * Creates an asset key for signing asset URLs (Embargoed Assets) * @param data Object with request payload * @param data.expiresAt number a UNIX timestamp in the future (but not more than 48 hours from time of calling) * @return Promise for the newly created AssetKey * @example ```javascript * const client = contentful.createClient({ * accessToken: '' * }) * * // Create assetKey * now = () => Math.floor(Date.now() / 1000) * const withExpiryIn1Hour = () => now() + 1 * 60 * 60 * client.getSpace('') * .then((space) => space.getEnvironment('')) * .then((environment) => environment.createAssetKey({ expiresAt: withExpiryIn1Hour() })) * .then((policy, secret) => console.log({ policy, secret })) * .catch(console.error) * ``` */ createAssetKey(payload: CreateAssetKeyProps): Promise; /** * Gets an Upload * @param id - Upload ID * @return Promise for an Upload * @example ```javascript * const client = contentful.createClient({ * accessToken: '' * }) * const uploadStream = createReadStream('path/to/filename_english.jpg') * * client.getSpace('') * .then((space) => space.getEnvironment('')) * .then((environment) => environment.getUpload('') * .then((upload) => console.log(upload)) * .catch(console.error) */ getUpload(id: string): Promise<{ delete: () => Promise; } & import("./export-types").UploadProps & { toPlainObject(): import("./export-types").UploadProps; }>; /** * Creates a Upload. * @param data - Object with file information. * @param data.file - Actual file content. Can be a string, an ArrayBuffer or a Stream. * @return Upload object containing information about the uploaded file. * @example ```javascript * const client = contentful.createClient({ * accessToken: '' * }) * const uploadStream = createReadStream('path/to/filename_english.jpg') * * client.getSpace('') * .then((space) => space.getEnvironment('')) * .then((environment) => environment.createUpload({file: uploadStream}) * .then((upload) => console.log(upload)) * .catch(console.error) * ``` */ createUpload: (data: { file: string | ArrayBuffer | Stream; }) => Promise<{ delete: () => Promise; } & import("./export-types").UploadProps & { toPlainObject(): import("./export-types").UploadProps; }>; /** * Gets a Locale * @param localeId - Locale ID * @return Promise for an Locale * @example ```javascript * const contentful = require('contentful-management') * * const client = contentful.createClient({ * accessToken: '' * }) * * client.getSpace('') * .then((space) => space.getEnvironment('')) * .then((environment) => environment.getLocale('')) * .then((locale) => console.log(locale)) * .catch(console.error) * ``` */ getLocale(localeId: string): Promise; /** * Gets a collection of Locales * @return Promise for a collection of Locales * @example ```javascript * const contentful = require('contentful-management') * * const client = contentful.createClient({ * accessToken: '' * }) * * client.getSpace('') * .then((space) => space.getEnvironment('')) * .then((environment) => environment.getLocales()) * .then((response) => console.log(response.items)) * .catch(console.error) * ``` */ getLocales(): Promise>; /** * Creates a Locale * @param data - Object representation of the Locale to be created * @return Promise for the newly created Locale * @example ```javascript * const contentful = require('contentful-management') * * const client = contentful.createClient({ * accessToken: '' * }) * * // Create locale * client.getSpace('') * .then((space) => space.getEnvironment('')) * .then((environment) => environment.createLocale({ * name: 'German (Austria)', * code: 'de-AT', * fallbackCode: 'de-DE', * optional: true * })) * .then((locale) => console.log(locale)) * .catch(console.error) * ``` */ createLocale(data: CreateLocaleProps): Promise; /** * Gets an UI Extension * @param id - Extension ID * @return Promise for an UI Extension * @example ```javascript * const contentful = require('contentful-management') * * const client = contentful.createClient({ * accessToken: '' * }) * * client.getSpace('') * .then((space) => space.getEnvironment('')) * .then((environment) => environment.getUiExtension('')) * .then((extension) => console.log(extension)) * .catch(console.error) * ``` */ getUiExtension(id: string): Promise; /** * Gets a collection of UI Extension * @return Promise for a collection of UI Extensions * @example ```javascript * const contentful = require('contentful-management') * * const client = contentful.createClient({ * accessToken: '' * }) * * client.getSpace('') * .then((space) => space.getEnvironment('')) * .then((environment) => environment.getUiExtensions() * .then((response) => console.log(response.items)) * .catch(console.error) * ``` */ getUiExtensions(): Promise>; /** * Creates a UI Extension * @param data - Object representation of the UI Extension to be created * @return Promise for the newly created UI Extension * @example ```javascript * const contentful = require('contentful-management') * * const client = contentful.createClient({ * accessToken: '' * }) * * client.getSpace('') * .then((space) => space.getEnvironment('')) * .then((environment) => environment.createUiExtension({ * extension: { * name: 'My awesome extension', * src: 'https://example.com/my', * fieldTypes: [ * { * type: 'Symbol' * }, * { * type: 'Text' * } * ], * sidebar: false * } * })) * .then((extension) => console.log(extension)) * .catch(console.error) * ``` */ createUiExtension(data: CreateExtensionProps): Promise; /** * Creates a UI Extension with a custom ID * @param id - Extension ID * @param data - Object representation of the UI Extension to be created * @return Promise for the newly created UI Extension * @example ```javascript * const contentful = require('contentful-management') * * const client = contentful.createClient({ * accessToken: '' * }) * * client.getSpace('') * .then((space) => space.getEnvironment('')) * .then((environment) => environment.createUiExtensionWithId('', { * extension: { * name: 'My awesome extension', * src: 'https://example.com/my', * fieldTypes: [ * { * type: 'Symbol' * }, * { * type: 'Text' * } * ], * sidebar: false * } * })) * .then((extension) => console.log(extension)) * .catch(console.error) * ``` */ createUiExtensionWithId(id: string, data: CreateExtensionProps): Promise; /** * Creates an App Installation * @param appDefinitionId - AppDefinition ID * @param data - AppInstallation data * @return Promise for an App Installation * @example ```javascript * const contentful = require('contentful-management') * * const client = contentful.createClient({ * accessToken: '' * }) * * client.getSpace('') * .then((space) => space.getEnvironment('')) * .then((environment) => environment.createAppInstallation('', { * parameters: { * someParameter: someValue * } * }) * .then((appInstallation) => console.log(appInstallation)) * .catch(console.error) * ``` */ createAppInstallation(appDefinitionId: string, data: CreateAppInstallationProps): Promise; /** * Gets an App Installation * @param id - AppDefintion ID * @return Promise for an App Installation * @example ```javascript * const contentful = require('contentful-management') * * const client = contentful.createClient({ * accessToken: '' * }) * * client.getSpace('') * .then((space) => space.getEnvironment('')) * .then((environment) => environment.getAppInstallation('')) * .then((appInstallation) => console.log(appInstallation)) * .catch(console.error) * ``` */ getAppInstallation(id: string): Promise; /** * Gets a collection of App Installation * @return Promise for a collection of App Installations * @example ```javascript * const contentful = require('contentful-management') * * const client = contentful.createClient({ * accessToken: '' * }) * * client.getSpace('') * .then((space) => space.getEnvironment('')) * .then((environment) => environment.getAppInstallations() * .then((response) => console.log(response.items)) * .catch(console.error) * ``` */ getAppInstallations(): Promise>; /** * Creates an app signed request * @param appDefinitionId - AppDefinition ID * @param data - SignedRequest data * @return Promise for a Signed Request * @example ```javascript * const contentful = require('contentful-management') * * const client = contentful.createClient({ * accessToken: '' * }) * * const data = { * method: 'POST', * path: '/request_path', * body: '{ "key": "data" }', * headers: { * 'x-my-header': 'some-value' * }, * } * * client.getSpace('') * .then((space) => space.getEnvironment('')) * .then((environment) => environment.createAppSignedRequest('', data) * .then((signedRequest) => console.log(signedRequest)) * .catch(console.error) * ``` */ createAppSignedRequest(appDefinitionId: string, data: CreateAppSignedRequestProps): Promise; /** * Gets all snapshots of an entry * @func getEntrySnapshots * @param entryId - Entry ID * @param query - query additional query paramaters * @return Promise for a collection of Entry Snapshots * @example ```javascript * const contentful = require('contentful-management') * * const client = contentful.createClient({ * accessToken: '' * }) * * client.getSpace('') * .then((space) => space.getEnvironment('')) * .then((environment) => environment.getEntrySnapshots('')) * .then((snapshots) => console.log(snapshots.items)) * .catch(console.error) * ``` */ getEntrySnapshots(entryId: string, query?: QueryOptions): Promise>, import("./export-types").SnapshotProps>>>; /** * Gets all snapshots of a contentType * @func getContentTypeSnapshots * @param contentTypeId - Content Type ID * @param query - query additional query paramaters * @return Promise for a collection of Content Type Snapshots * @example ```javascript * const contentful = require('contentful-management') * * const client = contentful.createClient({ * accessToken: '' * }) * * client.getSpace('') * .then((space) => space.getEnvironment('')) * .then((environment) => environment.getContentTypeSnapshots('')) * .then((snapshots) => console.log(snapshots.items)) * .catch(console.error) * ``` */ getContentTypeSnapshots(contentTypeId: string, query?: QueryOptions): Promise, import("./export-types").SnapshotProps>>; createTag(id: string, name: string, visibility?: TagVisibility | undefined): Promise; getTags(query?: BasicQueryOptions): Promise>; getTag(id: string): Promise; /** * Retrieves a Release by ID * @param releaseId * @returns Promise containing a wrapped Release * @example ```javascript * const contentful = require('contentful-management') * * const client = contentful.createClient({ * accessToken: '' * }) * * client.getSpace('') * .then((space) => space.getEnvironment('')) * .then((environment) => environment.getRelease('')) * .then((release) => console.log(release)) * .catch(console.error) * ``` */ getRelease(releaseId: string): Promise; /** * Gets a Collection of Releases, * @param {ReleaseQueryOptions} query filtering options for the collection result * @returns Promise containing a wrapped Release Collection * @example ```javascript * const contentful = require('contentful-management') * * const client = contentful.createClient({ * accessToken: '' * }) * * client.getSpace('') * .then((space) => space.getEnvironment('')) * .then((environment) => environment.getReleases({ 'entities.sys.id[in]': ',' })) * .then((releases) => console.log(releases)) * .catch(console.error) * ``` */ getReleases(query?: ReleaseQueryOptions | undefined): Promise>; /** * Creates a new Release with the entities and title in the payload * @param payload Object containing the payload in order to create a Release * @returns Promise containing a wrapped Release, that has other helper methods within. * @example ```javascript * const contentful = require('contentful-management') * * const client = contentful.createClient({ * accessToken: '' * }) * * const payload = { * title: 'My Release', * entities: { * sys: { type: 'Array' }, * items: [ * { sys: { linkType: 'Entry', type: 'Link', id: '' } } * ] * } * } * * client.getSpace('') * .then((space) => space.getEnvironment('')) * .then((environment) => environment.createRelease(payload)) * .then((release) => console.log(release)) * .catch(console.error) * ``` */ createRelease(payload: ReleasePayload): Promise; /** * Updates a Release and replaces all the properties. * @param {object} options, * @param options.releaseId the ID of the release * @param options.payload the payload to be updated in the Release * @param options.version Release sys.version that to be updated * @returns Promise containing a wrapped Release, that has helper methods within. * * @example ```javascript * const contentful = require('contentful-management') * * const client = contentful.createClient({ * accessToken: '' * }) * * * const payload = { * title: "Updated Release title", * entities: { * sys: { type: 'Array' }, * items: [ * { sys: { linkType: 'Entry', type: 'Link', id: '' } } * ] * } * } * * client.getSpace('') * .then((space) => space.getEnvironment('')) * .then((environment) => environment.updateRelease({ releaseId: '', version: 1, payload } )) * .then((release) => console.log(release)) * .catch(console.error) * ``` */ updateRelease({ releaseId, payload, version, }: { releaseId: string; payload: ReleasePayload; version: number; }): Promise; /** * Deletes a Release by ID - does not delete any entities. * @param releaseId the ID of the release * * @returns Promise containing a wrapped Release, that has helper methods within. * @example ```javascript * const contentful = require('contentful-management') * * const client = contentful.createClient({ * accessToken: '' * }) * * client.getSpace('') * .then((space) => space.getEnvironment('')) * .then((environment) => environment.deleteRelease('') * .catch(console.error) * ``` */ deleteRelease(releaseId: string): Promise; /** * Publishes all Entities contained in a Release. * @param options.releaseId the ID of the release * @param options.version the version of the release that is to be published * @returns Promise containing a wrapped Release, that has helper methods within. * * @example ```javascript * const contentful = require('contentful-management') * * const client = contentful.createClient({ * accessToken: '' * }) * * client.getSpace('') * .then((space) => space.getEnvironment('')) * .then((environment) => environment.publishRelease({ releaseId: '', version: 1 })) * .catch(console.error) * ``` */ publishRelease({ releaseId, version }: { releaseId: string; version: number; }): Promise>; /** * Unpublishes all Entities contained in a Release. * @param options.releaseId the ID of the release * @param options.version the version of the release that is to be published * @returns Promise containing a wrapped Release, that has helper methods within. * * @example ```javascript * const contentful = require('contentful-management') * * const client = contentful.createClient({ * accessToken: '' * }) * * client.getSpace('') * .then((space) => space.getEnvironment('')) * .then((environment) => environment.unpublishRelease({ releaseId: '', version: 1 })) * .catch(console.error) * ``` */ unpublishRelease({ releaseId, version }: { releaseId: string; version: number; }): Promise>; /** * Validates all Entities contained in a Release against an action (publish or unpublish) * @param options.releaseId the ID of the release * @param options.payload (optional) the type of action to be validated against * * @returns Promise containing a wrapped Release, that has helper methods within. * * @example ```javascript * const contentful = require('contentful-management') * * const client = contentful.createClient({ * accessToken: '' * }) * * client.getSpace('') * .then((space) => space.getEnvironment('')) * .then((environment) => environment.validateRelease({ releaseId: '', payload: { action: 'unpublish' } })) * .catch(console.error) * ``` */ validateRelease({ releaseId, payload, }: { releaseId: string; payload?: ReleaseValidatePayload | undefined; }): Promise>; /** * Retrieves a ReleaseAction by ID * @param params.releaseId The ID of a Release * @param params.actionId The ID of a Release Action * @returns Promise containing a wrapped ReleaseAction * @example ```javascript * const contentful = require('contentful-management') * * const client = contentful.createClient({ * accessToken: '' * }) * * client.getSpace('') * .then((space) => space.getEnvironment('')) * .then((environment) => environment.getReleaseAction({ releaseId: '', actionId: '' })) * .then((releaseAction) => console.log(releaseAction)) * .catch(console.error) * ``` */ getReleaseAction({ actionId, releaseId }: { actionId: string; releaseId: string; }): Promise>; /** * Gets a Collection of ReleaseActions * @param {string} params.releaseId ID of the Release to fetch the actions from * @param {ReleaseQueryOptions} params.query filtering options for the collection result * @returns Promise containing a wrapped ReleaseAction Collection * * @example ```javascript * const contentful = require('contentful-management') * * const client = contentful.createClient({ * accessToken: '' * }) * * client.getSpace('') * .then((space) => space.getEnvironment('')) * .then((environment) => environment.getReleaseActions({ releaseId: '', query: { 'sys.id[in]': ',' } })) * .then((releaseActions) => console.log(releaseActions)) * .catch(console.error) * ``` */ getReleaseActions({ releaseId, query, }: { releaseId: string; query?: ReleaseActionQueryOptions | undefined; }): Promise, import("./entities/release-action").ReleaseActionProps>>; };