1 | import type { RawAxiosRequestHeaders } from 'axios';
|
2 | import type { CollectionProp, GetExtensionParams, GetSpaceEnvironmentParams, QueryParams } from '../../common-types';
|
3 | import type { CreateExtensionProps, ExtensionProps } from '../../entities/extension';
|
4 | import type { OptionalDefaults } from '../wrappers/wrap';
|
5 | export type ExtensionPlainClientAPI = {
|
6 | /**
|
7 | * Fetches the Extension
|
8 | * @param params entity IDs to identify the Extension
|
9 | * @returns the Extension and its metadata
|
10 | * @throws if the request fails, or the Extension is not found
|
11 | * @example
|
12 | * ```javascript
|
13 | * const uiExtension = await client.extension.get({
|
14 | * spaceId: '<space_id>',
|
15 | * environmentId: '<environment_id>',
|
16 | * extensionId: '<extension_id>',
|
17 | * });
|
18 | * ```
|
19 | */
|
20 | get(params: OptionalDefaults<GetExtensionParams & QueryParams>): Promise<ExtensionProps>;
|
21 | /**
|
22 | * Fetches all Extensions of a Space/Environment
|
23 | * @param params entity IDs to identify the Space/Environment from which to fetch Extensions
|
24 | * @returns an object containing the array of Extensions
|
25 | * @throws if the request fails, or the Space/Environment is not found
|
26 | * @example
|
27 | * ```javascript
|
28 | * const results = await client.extension.getMany({
|
29 | * spaceId: '<space_id>',
|
30 | * environmentId: '<environment_id>',
|
31 | * });
|
32 | * ```
|
33 | */
|
34 | getMany(params: OptionalDefaults<GetSpaceEnvironmentParams & QueryParams>): Promise<CollectionProp<ExtensionProps>>;
|
35 | /**
|
36 | * Creates a new Extension with an auto-generated ID
|
37 | * @param params entity IDs to identify the Environment in which to create the Extension
|
38 | * @param rawData the Extension
|
39 | * @returns the created Extension and its metadata
|
40 | * @throws if the request fails, or the Space/Environment is not found
|
41 | * @example
|
42 | * ```javascript
|
43 | * const rawData = {
|
44 | * extension: {
|
45 | * name: 'My extension',
|
46 | * src: 'https://www.example.com',
|
47 | * fieldTypes: [
|
48 | * {
|
49 | * type: 'Symbol',
|
50 | * },
|
51 | * ],
|
52 | * sidebar: false,
|
53 | * }
|
54 | * };
|
55 | * const uiExtension = await client.extension.create(
|
56 | * {
|
57 | * spaceId: '<space_id>',
|
58 | * environmentId: '<environment_id>',
|
59 | * },
|
60 | * rawData
|
61 | * );
|
62 | * ```
|
63 | */
|
64 | create(params: OptionalDefaults<GetSpaceEnvironmentParams>, rawData: CreateExtensionProps, headers?: RawAxiosRequestHeaders): Promise<ExtensionProps>;
|
65 | /**
|
66 | * Creates a new Extension with a given ID
|
67 | * @param params entity IDs to identify the Environment in which to create the Extension
|
68 | * @param rawData the Extension
|
69 | * @returns the created Extension and its metadata
|
70 | * @throws if the request fails, or the Space/Environment is not found
|
71 | * @example
|
72 | * ```javascript
|
73 | * const rawData = {
|
74 | * extension: {
|
75 | * name: 'My extension',
|
76 | * src: 'https://www.example.com',
|
77 | * fieldTypes: [
|
78 | * {
|
79 | * type: 'Symbol',
|
80 | * },
|
81 | * ],
|
82 | * sidebar: false,
|
83 | * }
|
84 | * };
|
85 | * const uiExtension = await client.extension.createWithId(
|
86 | * {
|
87 | * spaceId: '<space_id>',
|
88 | * environmentId: '<environment_id>',
|
89 | * extensionId: '<extension_id>',
|
90 | * },
|
91 | * rawData
|
92 | * );
|
93 | * ```
|
94 | */
|
95 | createWithId(params: OptionalDefaults<GetExtensionParams>, rawData: CreateExtensionProps, headers?: RawAxiosRequestHeaders): Promise<ExtensionProps>;
|
96 | /**
|
97 | * Updates an Extension
|
98 | * @param params entity IDs to identify the Extension
|
99 | * @param rawData the Extension update
|
100 | * @param headers when updating an existing Extension, use the 'X-Contentful-Version' header to specify the last version of the Extension you are updating
|
101 | * @returns the updated Extension and its metadata
|
102 | * @throws if the request fails, or the Space/Environment is not found
|
103 | * @example
|
104 | * ```javascript
|
105 | * // Create Extension
|
106 | * let uiExtension = await client.extension.create(
|
107 | * {
|
108 | * spaceId: '<space_id>',
|
109 | * environmentId: '<environment_id>',
|
110 | * },
|
111 | * {
|
112 | * extension: {
|
113 | * name: 'My extension',
|
114 | * src: 'https://www.example.com',
|
115 | * fieldTypes: [
|
116 | * {
|
117 | * type: 'Symbol',
|
118 | * },
|
119 | * ],
|
120 | * sidebar: false,
|
121 | * },
|
122 | * }
|
123 | * );
|
124 | *
|
125 | * // Update Extension
|
126 | * uiExtension = await client.extension.update(
|
127 | * {
|
128 | * spaceId: '<space_id>',
|
129 | * environmentId: '<environment_id>',
|
130 | * extensionId: '<extension_id>',
|
131 | * },
|
132 | * {
|
133 | * sys: uiExtension.sys,
|
134 | * extension: {
|
135 | * ...uiExtension.extension,
|
136 | * name: 'Even more awesome extension',
|
137 | * },
|
138 | * }
|
139 | * );
|
140 | * ```
|
141 | */
|
142 | update(params: OptionalDefaults<GetExtensionParams>, rawData: ExtensionProps, headers?: RawAxiosRequestHeaders): Promise<ExtensionProps>;
|
143 | /**
|
144 | * Deletes the Extension
|
145 | * @param params entity IDs to identity the Extension
|
146 | * @throws if the request fails, or the Extension is not found
|
147 | * @example
|
148 | * ```javascript
|
149 | * await client.extension.delete({
|
150 | * spaceId: '<space_id>',
|
151 | * environmentId: '<environment_id>',
|
152 | * extensionId: '<extension_id>',
|
153 | * });
|
154 | * ```
|
155 | */
|
156 | delete(params: OptionalDefaults<GetExtensionParams>): Promise<any>;
|
157 | };
|