UNPKG

1.57 kBTypeScriptView Raw
1import type { ContentfulEnvironmentAPI } from '../create-environment-api';
2import type { DefaultElements, SysLink, BasicMetaSysProps, MakeRequest } from '../common-types';
3type EnvironmentMetaSys = BasicMetaSysProps & {
4 status: SysLink;
5 space: SysLink;
6 aliases?: Array<SysLink>;
7 aliasedEnvironment?: SysLink;
8};
9export type EnvironmentProps = {
10 /**
11 * System metadata
12 */
13 sys: EnvironmentMetaSys;
14 /**
15 * Name of the environment
16 */
17 name: string;
18};
19export type CreateEnvironmentProps = Partial<Omit<EnvironmentProps, 'sys'>>;
20export type Environment = ContentfulEnvironmentAPI & EnvironmentProps & DefaultElements<EnvironmentProps>;
21/**
22 * This method creates the API for the given environment with all the methods for
23 * reading and creating other entities. It also passes down a clone of the
24 * http client with a environment id, so the base path for requests now has the
25 * environment id already set.
26 * @private
27 * @param makeRequest - function to make requests via an adapter
28 * @param data - API response for a Environment
29 * @return
30 */
31export declare function wrapEnvironment(makeRequest: MakeRequest, data: EnvironmentProps): Environment;
32/**
33 * This method wraps each environment in a collection with the environment API. See wrapEnvironment
34 * above for more details.
35 * @private
36 */
37export declare const wrapEnvironmentCollection: (makeRequest: MakeRequest, data: import("../common-types").CollectionProp<EnvironmentProps>) => import("../common-types").Collection<Environment, EnvironmentProps>;
38export {};