UNPKG

2.91 kBTypeScriptView Raw
1import { DefaultElements, MetaLinkProps, BasicMetaSysProps, SysLink, MakeRequest } from '../common-types';
2export declare type EnvironmentAliasProps = {
3 /**
4 * System meta data
5 */
6 sys: BasicMetaSysProps & {
7 space: SysLink;
8 };
9 environment: {
10 sys: MetaLinkProps;
11 };
12};
13export declare type CreateEnvironmentAliasProps = Omit<EnvironmentAliasProps, 'sys'>;
14export interface EnvironmentAlias extends EnvironmentAliasProps, DefaultElements<EnvironmentAliasProps> {
15 /**
16 * Sends an update to the server with any changes made to the object's properties. Currently, you can only change the id of the alias's underlying environment. See the example below.
17 * @memberof EnvironmentAlias
18 * @func update
19 * @return {Promise<EnvironmentAlias>} Object returned from the server with updated changes.
20 * ```javascript
21 * const contentful = require('contentful-management')
22 *
23 * const client = contentful.createClient({
24 * accessToken: '<content_management_api_key>'
25 * })
26 *
27 * client.getSpace('<space_id>')
28 * .then((space) => space.getEnvironmentAlias('<environment_alias_id>'))
29 * .then((alias) => {
30 * alias.environment.sys.id = '<environment_id>'
31 * return alias.update()
32 * })
33 * .then((alias) => console.log(`alias ${alias.sys.id} updated.`))
34 * .catch(console.error)
35 * ```
36 */
37 update(): Promise<EnvironmentAlias>;
38 /**
39 * Deletes this object on the server.
40 * @memberof EnvironmentAlias
41 * @func delete
42 * @return {Promise<void>} Promise for the deletion. It contains no data, but the Promise error case should be handled.
43 * ```javascript
44 * const contentful = require('contentful-management')
45 *
46 * const client = contentful.createClient({
47 * accessToken: '<content_management_api_key>'
48 * })
49 *
50 * client.getSpace('<space_id>')
51 * .then((space) => space.getEnvironmentAlias('<environment_alias_id>'))
52 * .then((alias) => {
53 * return alias.delete()
54 * })
55 * .then(() => console.log(`Alias deleted.`))
56 * .catch(console.error)
57 * ```
58 */
59 delete(): Promise<void>;
60}
61/**
62 * @private
63 * @param makeRequest - function to make requests via an adapter
64 * @param data - Raw environment alias data
65 * @return Wrapped environment alias data
66 */
67export declare function wrapEnvironmentAlias(makeRequest: MakeRequest, data: EnvironmentAliasProps): EnvironmentAlias;
68/**
69 * @private
70 * @param makeRequest - function to make requests via an adapter
71 * @param data - Raw environment alias collection data
72 * @return Wrapped environment alias collection data
73 */
74export declare const wrapEnvironmentAliasCollection: (makeRequest: MakeRequest, data: import("../common-types").CollectionProp<EnvironmentAliasProps>) => import("../common-types").Collection<EnvironmentAlias, EnvironmentAliasProps>;