UNPKG

65 kBTypeScriptView Raw
1import type { Stream } from 'stream';
2import type { BasicCursorPaginationOptions, QueryOptions } from './common-types';
3import type { BasicQueryOptions, MakeRequest } from './common-types';
4import type { CreateAppInstallationProps } from './entities/app-installation';
5import type { CreateAppSignedRequestProps } from './entities/app-signed-request';
6import type { CreateAppActionCallProps } from './entities/app-action-call';
7import type { AssetFileProp, AssetProps, CreateAssetFromFilesOptions, CreateAssetProps } from './entities/asset';
8import type { CreateAssetKeyProps } from './entities/asset-key';
9import type { BulkAction, BulkActionPayload, BulkActionPublishPayload, BulkActionUnpublishPayload, BulkActionValidatePayload } from './entities/bulk-action';
10import type { ReleaseActionQueryOptions } from './entities/release-action';
11import type { ReleasePayload, ReleaseQueryOptions, ReleaseValidatePayload } from './entities/release';
12import type { ContentTypeProps, CreateContentTypeProps } from './entities/content-type';
13import type { CreateEntryProps, EntryProps, EntryReferenceOptionsProps, EntryReferenceProps } from './entities/entry';
14import type { CreateExtensionProps } from './entities/extension';
15import type { CreateLocaleProps } from './entities/locale';
16import type { TagVisibility } from './entities/tag';
17import type { CreateAppAccessTokenProps } from './entities/app-access-token';
18import type { ResourceQueryOptions } from './entities/resource';
19/**
20 * @private
21 */
22export type ContentfulEnvironmentAPI = ReturnType<typeof createEnvironmentApi>;
23/**
24 * Creates API object with methods to access the Environment API
25 * @param {ContentfulEnvironmentAPI} makeRequest - function to make requests via an adapter
26 * @return {ContentfulSpaceAPI}
27 * @private
28 */
29export default function createEnvironmentApi(makeRequest: MakeRequest): {
30 /**
31 * Deletes the environment
32 * @return Promise for the deletion. It contains no data, but the Promise error case should be handled.
33 * @example ```javascript
34 * const contentful = require('contentful-management')
35 *
36 * const client = contentful.createClient({
37 * accessToken: '<content_management_api_key>'
38 * })
39 *
40 * client.getSpace('<space_id>')
41 * .then((space) => space.getEnvironment('<environment-id>'))
42 * .then((environment) => environment.delete())
43 * .then(() => console.log('Environment deleted.'))
44 * .catch(console.error)
45 * ```
46 */
47 delete: () => Promise<void>;
48 /**
49 * Updates the environment
50 * @return Promise for the updated environment.
51 * @example ```javascript
52 * const contentful = require('contentful-management')
53 *
54 * const client = contentful.createClient({
55 * accessToken: '<content_management_api_key>'
56 * })
57 *
58 * client.getSpace('<space_id>')
59 * .then((space) => space.getEnvironment('<environment-id>'))
60 * .then((environment) => {
61 * environment.name = 'New name'
62 * return environment.update()
63 * })
64 * .then((environment) => console.log(`Environment ${environment.sys.id} renamed.`)
65 * .catch(console.error)
66 * ```
67 */
68 update: () => Promise<import("./entities/environment").Environment>;
69 /**
70 * Creates SDK Entry object (locally) from entry data
71 * @param entryData - Entry Data
72 * @return Entry
73 * @example ```javascript
74 * environment.getEntry('entryId').then(entry => {
75 *
76 * // Build a plainObject in order to make it usable for React (saving in state or redux)
77 * const plainObject = entry.toPlainObject();
78 *
79 * // The entry is being updated in some way as plainObject:
80 * const updatedPlainObject = {
81 * ...plainObject,
82 * fields: {
83 * ...plainObject.fields,
84 * title: {
85 * 'en-US': 'updatedTitle'
86 * }
87 * }
88 * };
89 *
90 * // Rebuild an sdk object out of the updated plainObject:
91 * const entryWithMethodsAgain = environment.getEntryFromData(updatedPlainObject);
92 *
93 * // Update with help of the sdk method:
94 * entryWithMethodsAgain.update();
95 *
96 * });
97 * ```
98 **/
99 getEntryFromData(entryData: EntryProps): import("./entities/entry").Entry;
100 /**
101 * Creates SDK Asset object (locally) from entry data
102 * @param assetData - Asset ID
103 * @return Asset
104 * @example ```javascript
105 * environment.getAsset('asset_id').then(asset => {
106 *
107 * // Build a plainObject in order to make it usable for React (saving in state or redux)
108 * const plainObject = asset.toPlainObject();
109 *
110 * // The asset is being updated in some way as plainObject:
111 * const updatedPlainObject = {
112 * ...plainObject,
113 * fields: {
114 * ...plainObject.fields,
115 * title: {
116 * 'en-US': 'updatedTitle'
117 * }
118 * }
119 * };
120 *
121 * // Rebuild an sdk object out of the updated plainObject:
122 * const assetWithMethodsAgain = environment.getAssetFromData(updatedPlainObject);
123 *
124 * // Update with help of the sdk method:
125 * assetWithMethodsAgain.update();
126 *
127 * });
128 * ```
129 */
130 getAssetFromData(assetData: AssetProps): import("./entities/asset").Asset;
131 /**
132 *
133 * @description Get a BulkAction by ID.
134 * See: https://www.contentful.com/developers/docs/references/content-management-api/#/reference/bulk-actions/bulk-action
135 * @param bulkActionId - ID of the BulkAction to fetch
136 * @returns - Promise with the BulkAction
137 *
138 * @example ```javascript
139 * const contentful = require('contentful-management')
140 *
141 * const client = contentful.createClient({
142 * accessToken: '<content_management_api_key>'
143 * })
144 *
145 * client.getSpace('<space_id>')
146 * .then((space) => space.getEnvironment('<environment_id>'))
147 * .then((environment) => environment.getBulkAction('<bulk_action_id>'))
148 * .then((bulkAction) => console.log(bulkAction))
149 * ```
150 */
151 getBulkAction<T extends BulkActionPayload = any>(bulkActionId: string): Promise<BulkAction<T>>;
152 /**
153 * @description Creates a BulkAction that will attempt to publish all items contained in the payload.
154 * See: https://www.contentful.com/developers/docs/references/content-management-api/#/reference/bulk-actions/publish-bulk-action
155 * @param {BulkActionPayload} payload - Object containing the items to be processed in the bulkAction
156 * @returns - Promise with the BulkAction
157 *
158 * @example
159 *
160 * ```javascript
161 * const contentful = require('contentful-management')
162 *
163 * const client = contentful.createClient({
164 * accessToken: '<content_management_api_key>'
165 * })
166 *
167 * const payload = {
168 * entities: {
169 * sys: { type: 'Array' }
170 * items: [
171 * { sys: { type: 'Link', id: '<entry-id>', linkType: 'Entry', version: 2 } }
172 * ]
173 * }
174 * }
175 *
176 * // Using Thenables
177 * client.getSpace('<space_id>')
178 * .then((space) => space.getEnvironment('<environment_id>'))
179 * .then((environment) => environment.createPublishBulkAction(payload))
180 * .then((bulkAction) => console.log(bulkAction.waitProcessing()))
181 * .catch(console.error)
182 *
183 * // Using async/await
184 * try {
185 * const space = await client.getSpace('<space_id>')
186 * const environment = await space.getEnvironment('<environment_id>')
187 * const bulkActionInProgress = await environment.createPublishBulkAction(payload)
188 *
189 * // You can wait for a recently created BulkAction to be processed by using `bulkAction.waitProcessing()`
190 * const bulkActionCompleted = await bulkActionInProgress.waitProcessing()
191 * console.log(bulkActionCompleted)
192 * } catch (error) {
193 * console.log(error)
194 * }
195 * ```
196 */
197 createPublishBulkAction(payload: BulkActionPublishPayload): Promise<BulkAction<BulkActionPublishPayload>>;
198 /**
199 * @description Creates a BulkAction that will attempt to validate all items contained in the payload.
200 * See: https://www.contentful.com/developers/docs/references/content-management-api/#/reference/bulk-actions/validate-bulk-action
201 * @param {BulkActionPayload} payload - Object containing the items to be processed in the bulkAction
202 * @returns - Promise with the BulkAction
203 *
204 * @example
205 *
206 * ```javascript
207 * const contentful = require('contentful-management')
208 *
209 * const client = contentful.createClient({
210 * accessToken: '<content_management_api_key>'
211 * })
212 *
213 * const payload = {
214 * action: 'publish',
215 * entities: {
216 * sys: { type: 'Array' }
217 * items: [
218 * { sys: { type: 'Link', id: '<entry-id>', linkType: 'Entry' } }
219 * ]
220 * }
221 * }
222 *
223 * // Using Thenables
224 * client.getSpace('<space_id>')
225 * .then((space) => space.getEnvironment('<environment_id>'))
226 * .then((environment) => environment.createValidateBulkAction(payload))
227 * .then((bulkAction) => console.log(bulkAction.waitProcessing()))
228 * .catch(console.error)
229 *
230 * // Using async/await
231 * try {
232 * const space = await client.getSpace('<space_id>')
233 * const environment = await space.getEnvironment('<environment_id>')
234 * const bulkActionInProgress = await environment.createValidateBulkAction(payload)
235 *
236 * // You can wait for a recently created BulkAction to be processed by using `bulkAction.waitProcessing()`
237 * const bulkActionCompleted = await bulkActionInProgress.waitProcessing()
238 * console.log(bulkActionCompleted)
239 * } catch (error) {
240 * console.log(error)
241 * }
242 * ```
243 */
244 createValidateBulkAction(payload: BulkActionValidatePayload): Promise<BulkAction<BulkActionValidatePayload>>;
245 /**
246 * @description Creates a BulkAction that will attempt to unpublish all items contained in the payload.
247 * See: https://www.contentful.com/developers/docs/references/content-management-api/#/reference/bulk-actions/unpublish-bulk-action
248 * @param {BulkActionPayload} payload - Object containing the items to be processed in the bulkAction
249 * @returns - Promise with the BulkAction
250 *
251 * @example
252 *
253 * ```javascript
254 * const contentful = require('contentful-management')
255 *
256 * const client = contentful.createClient({
257 * accessToken: '<content_management_api_key>'
258 * })
259 *
260 * const payload = {
261 * entities: {
262 * sys: { type: 'Array' }
263 * items: [
264 * { sys: { type: 'Link', id: 'entry-id', linkType: 'Entry' } }
265 * ]
266 * }
267 * }
268 *
269 * // Using Thenables
270 * client.getSpace('<space_id>')
271 * .then((space) => space.getEnvironment('<environment_id>'))
272 * .then((environment) => environment.createUnpublishBulkAction(payload))
273 * .then((bulkAction) => console.log(bulkAction.waitProcessing()))
274 * .catch(console.error)
275 *
276 * // Using async/await
277 * try {
278 * const space = await clientgetSpace('<space_id>')
279 * const environment = await space.getEnvironment('<environment_id>')
280 * const bulkActionInProgress = await environment.createUnpublishBulkAction(payload)
281 *
282 * // You can wait for a recently created BulkAction to be processed by using `bulkAction.waitProcessing()`
283 * const bulkActionCompleted = await bulkActionInProgress.waitProcessing()
284 * console.log(bulkActionCompleted)
285 * } catch (error) {
286 * console.log(error)
287 * }
288 * ```
289 */
290 createUnpublishBulkAction(payload: BulkActionUnpublishPayload): Promise<BulkAction<BulkActionUnpublishPayload>>;
291 /**
292 * Gets a Content Type
293 * @param contentTypeId - Content Type ID
294 * @return Promise for a Content Type
295 * @example ```javascript
296 * const contentful = require('contentful-management')
297 *
298 * const client = contentful.createClient({
299 * accessToken: '<content_management_api_key>'
300 * })
301 *
302 * client.getSpace('<space_id>')
303 * .then((space) => space.getEnvironment('<environment-id>'))
304 * .then((environment) => environment.getContentType('<content_type_id>'))
305 * .then((contentType) => console.log(contentType))
306 * .catch(console.error)
307 * ```
308 */
309 getContentType(contentTypeId: string): Promise<import("./entities/content-type").ContentType>;
310 /**
311 * Gets a collection of Content Types
312 * @param query - Object with search parameters. Check the <a href="https://www.contentful.com/developers/docs/javascript/tutorials/using-js-cda-sdk/#retrieving-entries-with-search-parameters">JS SDK tutorial</a> and the <a href="https://www.contentful.com/developers/docs/references/content-delivery-api/#/reference/search-parameters">REST API reference</a> for more details.
313 * @return Promise for a collection of Content Types
314 * @example ```javascript
315 * const contentful = require('contentful-management')
316 *
317 * const client = contentful.createClient({
318 * accessToken: '<content_management_api_key>'
319 * })
320 *
321 * client.getSpace('<space_id>')
322 * .then((space) => space.getEnvironment('<environment-id>'))
323 * .then((environment) => environment.getContentTypes())
324 * .then((response) => console.log(response.items))
325 * .catch(console.error)
326 * ```
327 */
328 getContentTypes(query?: QueryOptions): Promise<import("./common-types").Collection<import("./entities/content-type").ContentType, ContentTypeProps>>;
329 /**
330 * Creates a Content Type
331 * @param data - Object representation of the Content Type to be created
332 * @return Promise for the newly created Content Type
333 * @example ```javascript
334 * const contentful = require('contentful-management')
335 *
336 * const client = contentful.createClient({
337 * accessToken: '<content_management_api_key>'
338 * })
339 *
340 * client.getSpace('<space_id>')
341 * .then((space) => space.getEnvironment('<environment-id>'))
342 * .then((environment) => environment.createContentType({
343 * name: 'Blog Post',
344 * fields: [
345 * {
346 * id: 'title',
347 * name: 'Title',
348 * required: true,
349 * localized: false,
350 * type: 'Text'
351 * }
352 * ]
353 * }))
354 * .then((contentType) => console.log(contentType))
355 * .catch(console.error)
356 * ```
357 */
358 createContentType(data: CreateContentTypeProps): Promise<import("./entities/content-type").ContentType>;
359 /**
360 * Creates a Content Type with a custom ID
361 * @param contentTypeId - Content Type ID
362 * @param data - Object representation of the Content Type to be created
363 * @return Promise for the newly created Content Type
364 * @example ```javascript
365 * const contentful = require('contentful-management')
366 *
367 * const client = contentful.createClient({
368 * accessToken: '<content_management_api_key>'
369 * })
370 *
371 * client.getSpace('<space_id>')
372 * .then((space) => space.getEnvironment('<environment-id>'))
373 * .then((environment) => environment.createContentTypeWithId('<content-type-id>', {
374 * name: 'Blog Post',
375 * fields: [
376 * {
377 * id: 'title',
378 * name: 'Title',
379 * required: true,
380 * localized: false,
381 * type: 'Text'
382 * }
383 * ]
384 * }))
385 * .then((contentType) => console.log(contentType))
386 * .catch(console.error)
387 * ```
388 */
389 createContentTypeWithId(contentTypeId: string, data: CreateContentTypeProps): Promise<import("./entities/content-type").ContentType>;
390 /**
391 * Gets an EditorInterface for a ContentType
392 * @param contentTypeId - Content Type ID
393 * @return Promise for an EditorInterface
394 * @example ```javascript
395 * const contentful = require('contentful-management')
396 *
397 * const client = contentful.createClient({
398 * accessToken: '<content_management_api_key>'
399 * })
400 *
401 * client.getSpace('<space_id>')
402 * .then((space) => space.getEnvironment('<environment-id>'))
403 * .then((environment) => environment.getEditorInterfaceForContentType('<content_type_id>'))
404 * .then((EditorInterface) => console.log(EditorInterface))
405 * .catch(console.error)
406 * ```
407 */
408 getEditorInterfaceForContentType(contentTypeId: string): Promise<import("./export-types").EditorInterface>;
409 /**
410 * Gets all EditorInterfaces
411 * @return Promise for a collection of EditorInterface
412 * @example ```javascript
413 * const contentful = require('contentful-management')
414 *
415 * const client = contentful.createClient({
416 * accessToken: '<content_management_api_key>'
417 * })
418 *
419 * client.getSpace('<space_id>')
420 * .then((space) => space.getEnvironment('<environment-id>'))
421 * .then((environment) => environment.getEditorInterfaces())
422 * .then((response) => console.log(response.items))
423 * .catch(console.error)
424 * ```
425 */
426 getEditorInterfaces(): Promise<import("./common-types").Collection<import("./export-types").EditorInterface, import("./export-types").EditorInterfaceProps>>;
427 /**
428 * Gets an Entry
429 * Warning: if you are using the select operator, when saving, any field that was not selected will be removed
430 * from your entry in the backend
431 * @param id - Entry ID
432 * @param query - Object with search parameters. In this method it's only useful for `locale`.
433 * @return Promise for an Entry
434 * @example ```javascript
435 * const contentful = require('contentful-management')
436 *
437 * const client = contentful.createClient({
438 * accessToken: '<content_management_api_key>'
439 * })
440 *
441 * client.getSpace('<space_id>')
442 * .then((space) => space.getEnvironment('<environment-id>'))
443 * .then((environment) => environment.getEntry('<entry-id>'))
444 * .then((entry) => console.log(entry))
445 * .catch(console.error)
446 * ```
447 */
448 getEntry(id: string, query?: QueryOptions): Promise<import("./entities/entry").Entry>;
449 /**
450 * Deletes an Entry of this environment
451 * @param id - Entry ID
452 * @return Promise for the deletion. It contains no data, but the Promise error case should be handled.
453 * @example ```javascript
454 * const contentful = require('contentful-management')
455 *
456 * const client = contentful.createClient({
457 * accessToken: '<content_management_api_key>'
458 * })
459 *
460 * client.getSpace('<space_id>')
461 * .then((space) => space.getEnvironment('<environment-id>'))
462 * .then((environment) => environment.deleteEntry("4bmLXiuviAZH3jkj5DLRWE"))
463 * .then(() => console.log('Entry deleted.'))
464 * .catch(console.error)
465 * ```
466 */
467 deleteEntry(id: string): Promise<void>;
468 /**
469 * Gets a collection of Entries
470 * Warning: if you are using the select operator, when saving, any field that was not selected will be removed
471 * from your entry in the backend
472 * @param query - Object with search parameters. Check the <a href="https://www.contentful.com/developers/docs/javascript/tutorials/using-js-cda-sdk/#retrieving-entries-with-search-parameters">JS SDK tutorial</a> and the <a href="https://www.contentful.com/developers/docs/references/content-delivery-api/#/reference/search-parameters">REST API reference</a> for more details.
473 * @return Promise for a collection of Entries
474 * @example ```javascript
475 * const contentful = require('contentful-management')
476 *
477 * const client = contentful.createClient({
478 * accessToken: '<content_management_api_key>'
479 * })
480 *
481 * client.getSpace('<space_id>')
482 * .then((space) => space.getEnvironment('<environment-id>'))
483 * .then((environment) => environment.getEntries({'content_type': 'foo'})) // you can add more queries as 'key': 'value'
484 * .then((response) => console.log(response.items))
485 * .catch(console.error)
486 * ```
487 */
488 getEntries(query?: QueryOptions): Promise<import("./common-types").Collection<import("./entities/entry").Entry, EntryProps<import("./common-types").KeyValueMap>>>;
489 /**
490 * Gets a collection of published Entries
491 * @param query - Object with search parameters. Check the <a href="https://www.contentful.com/developers/docs/javascript/tutorials/using-js-cda-sdk/#retrieving-entries-with-search-parameters">JS SDK tutorial</a> and the <a href="https://www.contentful.com/developers/docs/references/content-delivery-api/#/reference/search-parameters">REST API reference</a> for more details.
492 * @return Promise for a collection of published Entries
493 * @example ```javascript
494 * const contentful = require('contentful-management')
495 *
496 * const client = contentful.createClient({
497 * accessToken: '<content_management_api_key>'
498 * })
499 *
500 * client.getSpace('<space_id>')
501 * .then((space) => space.getEnvironment('<environment-id>'))
502 * .then((environment) => environment.getPublishedEntries({'content_type': 'foo'})) // you can add more queries as 'key': 'value'
503 * .then((response) => console.log(response.items))
504 * .catch(console.error)
505 * ```
506 */
507 getPublishedEntries(query?: QueryOptions): Promise<import("./common-types").Collection<import("./entities/entry").Entry, EntryProps<import("./common-types").KeyValueMap>>>;
508 /**
509 * Creates a Entry
510 * @param contentTypeId - The Content Type ID of the newly created Entry
511 * @param data - Object representation of the Entry to be created
512 * @return Promise for the newly created Entry
513 * @example ```javascript
514 * const contentful = require('contentful-management')
515 *
516 * const client = contentful.createClient({
517 * accessToken: '<content_management_api_key>'
518 * })
519 *
520 * client.getSpace('<space_id>')
521 * .then((space) => space.getEnvironment('<environment-id>'))
522 * .then((environment) => environment.createEntry('<content_type_id>', {
523 * fields: {
524 * title: {
525 * 'en-US': 'Entry title'
526 * }
527 * }
528 * }))
529 * .then((entry) => console.log(entry))
530 * .catch(console.error)
531 * ```
532 */
533 createEntry(contentTypeId: string, data: Omit<EntryProps, "sys">): Promise<import("./entities/entry").Entry>;
534 /**
535 * Creates a Entry with a custom ID
536 * @param contentTypeId - The Content Type of the newly created Entry
537 * @param id - Entry ID
538 * @param data - Object representation of the Entry to be created
539 * @return Promise for the newly created Entry
540 * @example ```javascript
541 * const contentful = require('contentful-management')
542 *
543 * const client = contentful.createClient({
544 * accessToken: '<content_management_api_key>'
545 * })
546 *
547 * // Create entry
548 * client.getSpace('<space_id>')
549 * .then((space) => space.getEnvironment('<environment-id>'))
550 * .then((environment) => environment.createEntryWithId('<content_type_id>', '<entry_id>', {
551 * fields: {
552 * title: {
553 * 'en-US': 'Entry title'
554 * }
555 * }
556 * }))
557 * .then((entry) => console.log(entry))
558 * .catch(console.error)
559 * ```
560 */
561 createEntryWithId(contentTypeId: string, id: string, data: CreateEntryProps): Promise<import("./entities/entry").Entry>;
562 /**
563 * Get entry references
564 * @param entryId - Entry ID
565 * @param {Object} options.include - Level of the entry descendants from 1 up to 10 maximum
566 * @returns Promise of Entry references
567 * @example ```javascript
568 * const contentful = require('contentful-management');
569 *
570 * const client = contentful.createClient({
571 * accessToken: '<contentful_management_api_key>
572 * })
573 *
574 * // Get entry references
575 * client.getSpace('<space_id>')
576 * .then((space) => space.getEnvironment('<environment_id>'))
577 * .then((environment) => environment.getEntryReferences('<entry_id>', {include: number}))
578 * .then((entry) => console.log(entry.includes))
579 * // or
580 * .then((environment) => environment.getEntry('<entry_id>')).then((entry) => entry.references({include: number}))
581 * .catch(console.error)
582 * ```
583 */
584 getEntryReferences(entryId: string, options?: EntryReferenceOptionsProps): Promise<EntryReferenceProps>;
585 /**
586 * Gets an Asset
587 * Warning: if you are using the select operator, when saving, any field that was not selected will be removed
588 * from your entry in the backend
589 * @param id - Asset ID
590 * @param query - Object with search parameters. In this method it's only useful for `locale`.
591 * @return Promise for an Asset
592 * @example ```javascript
593 * const contentful = require('contentful-management')
594 *
595 * const client = contentful.createClient({
596 * accessToken: '<content_management_api_key>'
597 * })
598 *
599 * client.getSpace('<space_id>')
600 * .then((space) => space.getEnvironment('<environment-id>'))
601 * .then((environment) => environment.getAsset('<asset_id>'))
602 * .then((asset) => console.log(asset))
603 * .catch(console.error)
604 * ```
605 */
606 getAsset(id: string, query?: QueryOptions): Promise<import("./entities/asset").Asset>;
607 /**
608 * Gets a collection of Assets
609 * Warning: if you are using the select operator, when saving, any field that was not selected will be removed
610 * from your entry in the backend
611 * @param query - Object with search parameters. Check the <a href="https://www.contentful.com/developers/docs/javascript/tutorials/using-js-cda-sdk/#retrieving-entries-with-search-parameters">JS SDK tutorial</a> and the <a href="https://www.contentful.com/developers/docs/references/content-delivery-api/#/reference/search-parameters">REST API reference</a> for more details.
612 * @return Promise for a collection of Assets
613 * @example ```javascript
614 * const contentful = require('contentful-management')
615 *
616 * const client = contentful.createClient({
617 * accessToken: '<content_management_api_key>'
618 * })
619 *
620 * client.getSpace('<space_id>')
621 * .then((space) => space.getEnvironment('<environment-id>'))
622 * .then((environment) => environment.getAssets())
623 * .then((response) => console.log(response.items))
624 * .catch(console.error)
625 * ```
626 */
627 getAssets(query?: QueryOptions): Promise<import("./common-types").Collection<import("./entities/asset").Asset, AssetProps>>;
628 /**
629 * Gets a collection of published Assets
630 * @param query - Object with search parameters. Check the <a href="https://www.contentful.com/developers/docs/javascript/tutorials/using-js-cda-sdk/#retrieving-entries-with-search-parameters">JS SDK tutorial</a> and the <a href="https://www.contentful.com/developers/docs/references/content-delivery-api/#/reference/search-parameters">REST API reference</a> for more details.
631 * @return Promise for a collection of published Assets
632 * @example ```javascript
633 * const contentful = require('contentful-management')
634 *
635 * const client = contentful.createClient({
636 * accessToken: '<content_management_api_key>'
637 * })
638 *
639 * client.getSpace('<space_id>')
640 * .then((space) => space.getEnvironment('<environment-id>'))
641 * .then((environment) => environment.getPublishedAssets())
642 * .then((response) => console.log(response.items))
643 * .catch(console.error)
644 * ```
645 */
646 getPublishedAssets(query?: QueryOptions): Promise<import("./common-types").Collection<import("./entities/asset").Asset, AssetProps>>;
647 /**
648 * Creates a Asset. After creation, call asset.processForLocale or asset.processForAllLocales to start asset processing.
649 * @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.
650 * @return Promise for the newly created Asset
651 * @example ```javascript
652 * const client = contentful.createClient({
653 * accessToken: '<content_management_api_key>'
654 * })
655 *
656 * // Create asset
657 * client.getSpace('<space_id>')
658 * .then((space) => space.getEnvironment('<environment-id>'))
659 * .then((environment) => environment.createAsset({
660 * fields: {
661 * title: {
662 * 'en-US': 'Playsam Streamliner'
663 * },
664 * file: {
665 * 'en-US': {
666 * contentType: 'image/jpeg',
667 * fileName: 'example.jpeg',
668 * upload: 'https://example.com/example.jpg'
669 * }
670 * }
671 * }
672 * }))
673 * .then((asset) => asset.processForLocale("en-US")) // OR asset.processForAllLocales()
674 * .then((asset) => console.log(asset))
675 * .catch(console.error)
676 * ```
677 */
678 createAsset(data: CreateAssetProps): Promise<import("./entities/asset").Asset>;
679 /**
680 * Creates a Asset with a custom ID. After creation, call asset.processForLocale or asset.processForAllLocales to start asset processing.
681 * @param id - Asset ID
682 * @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.
683 * @return Promise for the newly created Asset
684 * @example ```javascript
685 * const client = contentful.createClient({
686 * accessToken: '<content_management_api_key>'
687 * })
688 *
689 * // Create asset
690 * client.getSpace('<space_id>')
691 * .then((space) => space.getEnvironment('<environment-id>'))
692 * .then((environment) => environment.createAssetWithId('<asset_id>', {
693 * title: {
694 * 'en-US': 'Playsam Streamliner'
695 * },
696 * file: {
697 * 'en-US': {
698 * contentType: 'image/jpeg',
699 * fileName: 'example.jpeg',
700 * upload: 'https://example.com/example.jpg'
701 * }
702 * }
703 * }))
704 * .then((asset) => asset.process())
705 * .then((asset) => console.log(asset))
706 * .catch(console.error)
707 * ```
708 */
709 createAssetWithId(id: string, data: CreateAssetProps): Promise<import("./entities/asset").Asset>;
710 /**
711 * Creates a Asset based on files. After creation, call asset.processForLocale or asset.processForAllLocales to start asset processing.
712 * @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.
713 * @param data.fields.file.[LOCALE].file - Can be a string, an ArrayBuffer or a Stream.
714 * @return Promise for the newly created Asset
715 * @example ```javascript
716 * const client = contentful.createClient({
717 * accessToken: '<content_management_api_key>'
718 * })
719 *
720 * client.getSpace('<space_id>')
721 * .then((space) => space.getEnvironment('<environment-id>'))
722 * .then((environment) => environment.createAssetFromFiles({
723 * fields: {
724 * file: {
725 * 'en-US': {
726 * contentType: 'image/jpeg',
727 * fileName: 'filename_english.jpg',
728 * file: createReadStream('path/to/filename_english.jpg')
729 * },
730 * 'de-DE': {
731 * contentType: 'image/svg+xml',
732 * fileName: 'filename_german.svg',
733 * file: '<svg><path fill="red" d="M50 50h150v50H50z"/></svg>'
734 * }
735 * }
736 * }
737 * }))
738 * .then((asset) => console.log(asset))
739 * .catch(console.error)
740 * ```
741 */
742 createAssetFromFiles(data: Omit<AssetFileProp, "sys">, options?: CreateAssetFromFilesOptions): Promise<import("./entities/asset").Asset>;
743 /**
744 * Creates an asset key for signing asset URLs (Embargoed Assets)
745 * @param data Object with request payload
746 * @param data.expiresAt number a UNIX timestamp in the future (but not more than 48 hours from time of calling)
747 * @return Promise for the newly created AssetKey
748 * @example ```javascript
749 * const client = contentful.createClient({
750 * accessToken: '<content_management_api_key>'
751 * })
752 *
753 * // Create assetKey
754 * now = () => Math.floor(Date.now() / 1000)
755 * const withExpiryIn1Hour = () => now() + 1 * 60 * 60
756 * client.getSpace('<space_id>')
757 * .then((space) => space.getEnvironment('<environment-id>'))
758 * .then((environment) => environment.createAssetKey({ expiresAt: withExpiryIn1Hour() }))
759 * .then((policy, secret) => console.log({ policy, secret }))
760 * .catch(console.error)
761 * ```
762 */
763 createAssetKey(payload: CreateAssetKeyProps): Promise<import("./entities/asset-key").AssetKey>;
764 /**
765 * Gets an Upload
766 * @param id - Upload ID
767 * @return Promise for an Upload
768 * @example ```javascript
769 * const client = contentful.createClient({
770 * accessToken: '<content_management_api_key>'
771 * })
772 * const uploadStream = createReadStream('path/to/filename_english.jpg')
773 *
774 * client.getSpace('<space_id>')
775 * .then((space) => space.getEnvironment('<environment-id>'))
776 * .then((environment) => environment.getUpload('<upload-id>')
777 * .then((upload) => console.log(upload))
778 * .catch(console.error)
779 */
780 getUpload(id: string): Promise<{
781 delete: () => Promise<void>;
782 } & import("./export-types").UploadProps & {
783 toPlainObject(): import("./export-types").UploadProps;
784 }>;
785 /**
786 * Creates a Upload.
787 * @param data - Object with file information.
788 * @param data.file - Actual file content. Can be a string, an ArrayBuffer or a Stream.
789 * @return Upload object containing information about the uploaded file.
790 * @example ```javascript
791 * const client = contentful.createClient({
792 * accessToken: '<content_management_api_key>'
793 * })
794 * const uploadStream = createReadStream('path/to/filename_english.jpg')
795 *
796 * client.getSpace('<space_id>')
797 * .then((space) => space.getEnvironment('<environment-id>'))
798 * .then((environment) => environment.createUpload({file: uploadStream})
799 * .then((upload) => console.log(upload))
800 * .catch(console.error)
801 * ```
802 */
803 createUpload: (data: {
804 file: string | ArrayBuffer | Stream;
805 }) => Promise<{
806 delete: () => Promise<void>;
807 } & import("./export-types").UploadProps & {
808 toPlainObject(): import("./export-types").UploadProps;
809 }>;
810 /**
811 * Gets a Locale
812 * @param localeId - Locale ID
813 * @return Promise for an Locale
814 * @example ```javascript
815 * const contentful = require('contentful-management')
816 *
817 * const client = contentful.createClient({
818 * accessToken: '<content_management_api_key>'
819 * })
820 *
821 * client.getSpace('<space_id>')
822 * .then((space) => space.getEnvironment('<environment-id>'))
823 * .then((environment) => environment.getLocale('<locale_id>'))
824 * .then((locale) => console.log(locale))
825 * .catch(console.error)
826 * ```
827 */
828 getLocale(localeId: string): Promise<import("./entities/locale").Locale>;
829 /**
830 * Gets a collection of Locales
831 * @return Promise for a collection of Locales
832 * @example ```javascript
833 * const contentful = require('contentful-management')
834 *
835 * const client = contentful.createClient({
836 * accessToken: '<content_management_api_key>'
837 * })
838 *
839 * client.getSpace('<space_id>')
840 * .then((space) => space.getEnvironment('<environment-id>'))
841 * .then((environment) => environment.getLocales())
842 * .then((response) => console.log(response.items))
843 * .catch(console.error)
844 * ```
845 */
846 getLocales(): Promise<import("./common-types").Collection<import("./entities/locale").Locale, import("./entities/locale").LocaleProps>>;
847 /**
848 * Creates a Locale
849 * @param data - Object representation of the Locale to be created
850 * @return Promise for the newly created Locale
851 * @example ```javascript
852 * const contentful = require('contentful-management')
853 *
854 * const client = contentful.createClient({
855 * accessToken: '<content_management_api_key>'
856 * })
857 *
858 * // Create locale
859 * client.getSpace('<space_id>')
860 * .then((space) => space.getEnvironment('<environment-id>'))
861 * .then((environment) => environment.createLocale({
862 * name: 'German (Austria)',
863 * code: 'de-AT',
864 * fallbackCode: 'de-DE',
865 * optional: true
866 * }))
867 * .then((locale) => console.log(locale))
868 * .catch(console.error)
869 * ```
870 */
871 createLocale(data: CreateLocaleProps): Promise<import("./entities/locale").Locale>;
872 /**
873 * Gets an UI Extension
874 * @param id - Extension ID
875 * @return Promise for an UI Extension
876 * @example ```javascript
877 * const contentful = require('contentful-management')
878 *
879 * const client = contentful.createClient({
880 * accessToken: '<content_management_api_key>'
881 * })
882 *
883 * client.getSpace('<space_id>')
884 * .then((space) => space.getEnvironment('<environment-id>'))
885 * .then((environment) => environment.getUiExtension('<extension-id>'))
886 * .then((extension) => console.log(extension))
887 * .catch(console.error)
888 * ```
889 */
890 getUiExtension(id: string): Promise<import("./entities/extension").Extension>;
891 /**
892 * Gets a collection of UI Extension
893 * @return Promise for a collection of UI Extensions
894 * @example ```javascript
895 * const contentful = require('contentful-management')
896 *
897 * const client = contentful.createClient({
898 * accessToken: '<content_management_api_key>'
899 * })
900 *
901 * client.getSpace('<space_id>')
902 * .then((space) => space.getEnvironment('<environment-id>'))
903 * .then((environment) => environment.getUiExtensions()
904 * .then((response) => console.log(response.items))
905 * .catch(console.error)
906 * ```
907 */
908 getUiExtensions(): Promise<import("./common-types").Collection<import("./entities/extension").Extension, import("./entities/extension").ExtensionProps>>;
909 /**
910 * Creates a UI Extension
911 * @param data - Object representation of the UI Extension to be created
912 * @return Promise for the newly created UI Extension
913 * @example ```javascript
914 * const contentful = require('contentful-management')
915 *
916 * const client = contentful.createClient({
917 * accessToken: '<content_management_api_key>'
918 * })
919 *
920 * client.getSpace('<space_id>')
921 * .then((space) => space.getEnvironment('<environment-id>'))
922 * .then((environment) => environment.createUiExtension({
923 * extension: {
924 * name: 'My awesome extension',
925 * src: 'https://example.com/my',
926 * fieldTypes: [
927 * {
928 * type: 'Symbol'
929 * },
930 * {
931 * type: 'Text'
932 * }
933 * ],
934 * sidebar: false
935 * }
936 * }))
937 * .then((extension) => console.log(extension))
938 * .catch(console.error)
939 * ```
940 */
941 createUiExtension(data: CreateExtensionProps): Promise<import("./entities/extension").Extension>;
942 /**
943 * Creates a UI Extension with a custom ID
944 * @param id - Extension ID
945 * @param data - Object representation of the UI Extension to be created
946 * @return Promise for the newly created UI Extension
947 * @example ```javascript
948 * const contentful = require('contentful-management')
949 *
950 * const client = contentful.createClient({
951 * accessToken: '<content_management_api_key>'
952 * })
953 *
954 * client.getSpace('<space_id>')
955 * .then((space) => space.getEnvironment('<environment-id>'))
956 * .then((environment) => environment.createUiExtensionWithId('<extension_id>', {
957 * extension: {
958 * name: 'My awesome extension',
959 * src: 'https://example.com/my',
960 * fieldTypes: [
961 * {
962 * type: 'Symbol'
963 * },
964 * {
965 * type: 'Text'
966 * }
967 * ],
968 * sidebar: false
969 * }
970 * }))
971 * .then((extension) => console.log(extension))
972 * .catch(console.error)
973 * ```
974 */
975 createUiExtensionWithId(id: string, data: CreateExtensionProps): Promise<import("./entities/extension").Extension>;
976 /**
977 * Creates an App Installation
978 * @param appDefinitionId - AppDefinition ID
979 * @param data - AppInstallation data
980 * @param options.acceptAllTerms - Flag for accepting Apps' Marketplace EULA, Terms, and Privacy policy (need to pass `{acceptAllTerms: true}` to install a marketplace app)
981 * @return Promise for an App Installation
982 * @example ```javascript
983 * const contentful = require('contentful-management')
984 *
985 * const client = contentful.createClient({
986 * accessToken: '<content_management_api_key>'
987 * })
988 *
989 * client.getSpace('<space_id>')
990 * .then((space) => space.getEnvironment('<environment-id>'))
991 * .then((environment) => environment.createAppInstallation('<app_definition_id>', {
992 * parameters: {
993 * someParameter: someValue
994 * }
995 * })
996 * .then((appInstallation) => console.log(appInstallation))
997 * .catch(console.error)
998 * ```
999 */
1000 createAppInstallation(appDefinitionId: string, data: CreateAppInstallationProps, { acceptAllTerms }?: {
1001 acceptAllTerms?: boolean;
1002 }): Promise<import("./entities/app-installation").AppInstallation>;
1003 /**
1004 * Gets an App Installation
1005 * @param id - AppDefintion ID
1006 * @return Promise for an App Installation
1007 * @example ```javascript
1008 * const contentful = require('contentful-management')
1009 *
1010 * const client = contentful.createClient({
1011 * accessToken: '<content_management_api_key>'
1012 * })
1013 *
1014 * client.getSpace('<space_id>')
1015 * .then((space) => space.getEnvironment('<environment-id>'))
1016 * .then((environment) => environment.getAppInstallation('<app-definition-id>'))
1017 * .then((appInstallation) => console.log(appInstallation))
1018 * .catch(console.error)
1019 * ```
1020 */
1021 getAppInstallation(id: string): Promise<import("./entities/app-installation").AppInstallation>;
1022 /**
1023 * Gets a collection of App Installation
1024 * @return Promise for a collection of App Installations
1025 * @example ```javascript
1026 * const contentful = require('contentful-management')
1027 *
1028 * const client = contentful.createClient({
1029 * accessToken: '<content_management_api_key>'
1030 * })
1031 *
1032 * client.getSpace('<space_id>')
1033 * .then((space) => space.getEnvironment('<environment-id>'))
1034 * .then((environment) => environment.getAppInstallations()
1035 * .then((response) => console.log(response.items))
1036 * .catch(console.error)
1037 * ```
1038 */
1039 getAppInstallations(): Promise<import("./common-types").Collection<import("./entities/app-installation").AppInstallation, import("./entities/app-installation").AppInstallationProps>>;
1040 /**
1041 * Creates an app action call
1042 * @param appDefinitionId - AppDefinition ID
1043 * @param appActionId - action ID
1044 * @param data - App Action Call data
1045 * @return Promise for an App Action Call
1046 * @example ```javascript
1047 * const contentful = require('contentful-management')
1048 *
1049 * const client = contentful.createClient({
1050 * accessToken: '<content_management_api_key>'
1051 * })
1052 *
1053 * const data = {
1054 * headers: {
1055 * 'x-my-header': 'some-value'
1056 * },
1057 * body: {
1058 * 'some-body-value': true
1059 * }
1060 * }
1061 *
1062 * client.getSpace('<space_id>')
1063 * .then((space) => space.getEnvironment('<environment-id>'))
1064 * .then((environment) => environment.createAppActionCall('<app_definition_id>', '<action_id>', data)
1065 * .then((appActionCall) => console.log(appActionCall))
1066 * .catch(console.error)
1067 * ```
1068 */
1069 createAppActionCall(appDefinitionId: string, appActionId: string, data: CreateAppActionCallProps): Promise<import("./entities/app-action-call").AppActionCall>;
1070 /**
1071 * Creates an app signed request
1072 * @param appDefinitionId - AppDefinition ID
1073 * @param data - SignedRequest data
1074 * @return Promise for a Signed Request
1075 * @example ```javascript
1076 * const contentful = require('contentful-management')
1077 *
1078 * const client = contentful.createClient({
1079 * accessToken: '<content_management_api_key>'
1080 * })
1081 *
1082 * const data = {
1083 * method: 'POST',
1084 * path: '/request_path',
1085 * body: '{ "key": "data" }',
1086 * headers: {
1087 * 'x-my-header': 'some-value'
1088 * },
1089 * }
1090 *
1091 * client.getSpace('<space_id>')
1092 * .then((space) => space.getEnvironment('<environment-id>'))
1093 * .then((environment) => environment.createAppSignedRequest('<app_definition_id>', data)
1094 * .then((signedRequest) => console.log(signedRequest))
1095 * .catch(console.error)
1096 * ```
1097 */
1098 createAppSignedRequest(appDefinitionId: string, data: CreateAppSignedRequestProps): Promise<import("./entities/app-signed-request").AppSignedRequest>;
1099 /**
1100 * Creates an app access token
1101 * @param appDefinitionId - AppDefinition ID
1102 * @param data - Json Web Token
1103 * @return Promise for an app access token
1104 * @example ```javascript
1105 * const contentful = require('contentful-management')
1106 * const { sign } = require('jsonwebtoken')
1107 *
1108 * const signOptions = { algorithm: 'RS256', issuer: '<app_definition_id>', expiresIn: '10m' }
1109 *
1110 * const client = contentful.createClient({
1111 * accessToken: '<content_management_api_key>'
1112 * })
1113 *
1114 * const data = {
1115 * jwt: sign({}, '<private_key>', signOptions)
1116 * }
1117 *
1118 * client.getSpace('<space_id>')
1119 * .then((space) => space.getEnvironment('<environment-id>'))
1120 * .then((environment) => environment.createAppAccessToken('<app_definition_id>', data)
1121 * .then((appAccessToken) => console.log(appAccessToken))
1122 * .catch(console.error)
1123 * ```
1124 */
1125 createAppAccessToken(appDefinitionId: string, data: CreateAppAccessTokenProps): Promise<import("./entities/app-access-token").AppAccessToken>;
1126 /**
1127 * Gets all snapshots of an entry
1128 * @func getEntrySnapshots
1129 * @param entryId - Entry ID
1130 * @param query - query additional query paramaters
1131 * @return Promise for a collection of Entry Snapshots
1132 * @example ```javascript
1133 * const contentful = require('contentful-management')
1134 *
1135 * const client = contentful.createClient({
1136 * accessToken: '<content_management_api_key>'
1137 * })
1138 *
1139 * client.getSpace('<space_id>')
1140 * .then((space) => space.getEnvironment('<environment-id>'))
1141 * .then((environment) => environment.getEntrySnapshots('<entry_id>'))
1142 * .then((snapshots) => console.log(snapshots.items))
1143 * .catch(console.error)
1144 * ```
1145 */
1146 getEntrySnapshots(entryId: string, query?: QueryOptions): Promise<import("./common-types").Collection<import("./export-types").Snapshot<EntryProps>, import("./export-types").SnapshotProps<EntryProps>>>;
1147 /**
1148 * Gets all snapshots of a contentType
1149 * @func getContentTypeSnapshots
1150 * @param contentTypeId - Content Type ID
1151 * @param query - query additional query paramaters
1152 * @return Promise for a collection of Content Type Snapshots
1153 * @example ```javascript
1154 * const contentful = require('contentful-management')
1155 *
1156 * const client = contentful.createClient({
1157 * accessToken: '<content_management_api_key>'
1158 * })
1159 *
1160 * client.getSpace('<space_id>')
1161 * .then((space) => space.getEnvironment('<environment-id>'))
1162 * .then((environment) => environment.getContentTypeSnapshots('<contentTypeId>'))
1163 * .then((snapshots) => console.log(snapshots.items))
1164 * .catch(console.error)
1165 * ```
1166 */
1167 getContentTypeSnapshots(contentTypeId: string, query?: QueryOptions): Promise<import("./common-types").Collection<import("./export-types").Snapshot<ContentTypeProps>, import("./export-types").SnapshotProps<ContentTypeProps>>>;
1168 createTag(id: string, name: string, visibility?: TagVisibility): Promise<import("./entities/tag").Tag>;
1169 getTags(query?: BasicQueryOptions): Promise<import("./common-types").Collection<import("./entities/tag").Tag, import("./entities/tag").TagProps>>;
1170 getTag(id: string): Promise<import("./entities/tag").Tag>;
1171 /**
1172 * Retrieves a Release by ID
1173 * @param releaseId
1174 * @returns Promise containing a wrapped Release
1175 * @example ```javascript
1176 * const contentful = require('contentful-management')
1177 *
1178 * const client = contentful.createClient({
1179 * accessToken: '<content_management_api_key>'
1180 * })
1181 *
1182 * client.getSpace('<space_id>')
1183 * .then((space) => space.getEnvironment('<environment-id>'))
1184 * .then((environment) => environment.getRelease('<release_id>'))
1185 * .then((release) => console.log(release))
1186 * .catch(console.error)
1187 * ```
1188 */
1189 getRelease(releaseId: string): Promise<import("./entities/release").Release>;
1190 /**
1191 * Gets a Collection of Releases,
1192 * @param {ReleaseQueryOptions} query filtering options for the collection result
1193 * @returns Promise containing a wrapped Release Collection
1194 * @example ```javascript
1195 * const contentful = require('contentful-management')
1196 *
1197 * const client = contentful.createClient({
1198 * accessToken: '<content_management_api_key>'
1199 * })
1200 *
1201 * client.getSpace('<space_id>')
1202 * .then((space) => space.getEnvironment('<environment-id>'))
1203 * .then((environment) => environment.getReleases({ 'entities.sys.id[in]': '<asset_id>,<entry_id>' }))
1204 * .then((releases) => console.log(releases))
1205 * .catch(console.error)
1206 * ```
1207 */
1208 getReleases(query?: ReleaseQueryOptions): Promise<import("./common-types").CursorPaginatedCollection<import("./entities/release").Release, import("./entities/release").ReleaseProps>>;
1209 /**
1210 * Creates a new Release with the entities and title in the payload
1211 * @param payload Object containing the payload in order to create a Release
1212 * @returns Promise containing a wrapped Release, that has other helper methods within.
1213 * @example ```javascript
1214 * const contentful = require('contentful-management')
1215 *
1216 * const client = contentful.createClient({
1217 * accessToken: '<content_management_api_key>'
1218 * })
1219 *
1220 * const payload = {
1221 * title: 'My Release',
1222 * entities: {
1223 * sys: { type: 'Array' },
1224 * items: [
1225 * { sys: { linkType: 'Entry', type: 'Link', id: '<entry_id>' } }
1226 * ]
1227 * }
1228 * }
1229 *
1230 * client.getSpace('<space_id>')
1231 * .then((space) => space.getEnvironment('<environment-id>'))
1232 * .then((environment) => environment.createRelease(payload))
1233 * .then((release) => console.log(release))
1234 * .catch(console.error)
1235 * ```
1236 */
1237 createRelease(payload: ReleasePayload): Promise<import("./entities/release").Release>;
1238 /**
1239 * Updates a Release and replaces all the properties.
1240 * @param {object} options,
1241 * @param options.releaseId the ID of the release
1242 * @param options.payload the payload to be updated in the Release
1243 * @param options.version Release sys.version that to be updated
1244 * @returns Promise containing a wrapped Release, that has helper methods within.
1245 *
1246 * @example ```javascript
1247 * const contentful = require('contentful-management')
1248 *
1249 * const client = contentful.createClient({
1250 * accessToken: '<content_management_api_key>'
1251 * })
1252 *
1253 *
1254 * const payload = {
1255 * title: "Updated Release title",
1256 * entities: {
1257 * sys: { type: 'Array' },
1258 * items: [
1259 * { sys: { linkType: 'Entry', type: 'Link', id: '<entry_id>' } }
1260 * ]
1261 * }
1262 * }
1263 *
1264 * client.getSpace('<space_id>')
1265 * .then((space) => space.getEnvironment('<environment-id>'))
1266 * .then((environment) => environment.updateRelease({ releaseId: '<release_id>', version: 1, payload } ))
1267 * .then((release) => console.log(release))
1268 * .catch(console.error)
1269 * ```
1270 */
1271 updateRelease({ releaseId, payload, version, }: {
1272 releaseId: string;
1273 payload: ReleasePayload;
1274 version: number;
1275 }): Promise<import("./entities/release").Release>;
1276 /**
1277 * Deletes a Release by ID - does not delete any entities.
1278 * @param releaseId the ID of the release
1279 *
1280 * @returns Promise containing a wrapped Release, that has helper methods within.
1281 * @example ```javascript
1282 * const contentful = require('contentful-management')
1283 *
1284 * const client = contentful.createClient({
1285 * accessToken: '<content_management_api_key>'
1286 * })
1287 *
1288 * client.getSpace('<space_id>')
1289 * .then((space) => space.getEnvironment('<environment-id>'))
1290 * .then((environment) => environment.deleteRelease('<release_id>')
1291 * .catch(console.error)
1292 * ```
1293 */
1294 deleteRelease(releaseId: string): Promise<void>;
1295 /**
1296 * Publishes all Entities contained in a Release.
1297 * @param options.releaseId the ID of the release
1298 * @param options.version the version of the release that is to be published
1299 * @returns Promise containing a wrapped Release, that has helper methods within.
1300 *
1301 * @example ```javascript
1302 * const contentful = require('contentful-management')
1303 *
1304 * const client = contentful.createClient({
1305 * accessToken: '<content_management_api_key>'
1306 * })
1307 *
1308 * client.getSpace('<space_id>')
1309 * .then((space) => space.getEnvironment('<environment-id>'))
1310 * .then((environment) => environment.publishRelease({ releaseId: '<release_id>', version: 1 }))
1311 * .catch(console.error)
1312 * ```
1313 */
1314 publishRelease({ releaseId, version }: {
1315 releaseId: string;
1316 version: number;
1317 }): Promise<import("./entities/release-action").ReleaseAction<any>>;
1318 /**
1319 * Unpublishes all Entities contained in a Release.
1320 * @param options.releaseId the ID of the release
1321 * @param options.version the version of the release that is to be published
1322 * @returns Promise containing a wrapped Release, that has helper methods within.
1323 *
1324 * @example ```javascript
1325 * const contentful = require('contentful-management')
1326 *
1327 * const client = contentful.createClient({
1328 * accessToken: '<content_management_api_key>'
1329 * })
1330 *
1331 * client.getSpace('<space_id>')
1332 * .then((space) => space.getEnvironment('<environment-id>'))
1333 * .then((environment) => environment.unpublishRelease({ releaseId: '<release_id>', version: 1 }))
1334 * .catch(console.error)
1335 * ```
1336 */
1337 unpublishRelease({ releaseId, version }: {
1338 releaseId: string;
1339 version: number;
1340 }): Promise<import("./entities/release-action").ReleaseAction<any>>;
1341 /**
1342 * Validates all Entities contained in a Release against an action (publish or unpublish)
1343 * @param options.releaseId the ID of the release
1344 * @param options.payload (optional) the type of action to be validated against
1345 *
1346 * @returns Promise containing a wrapped Release, that has helper methods within.
1347 *
1348 * @example ```javascript
1349 * const contentful = require('contentful-management')
1350 *
1351 * const client = contentful.createClient({
1352 * accessToken: '<content_management_api_key>'
1353 * })
1354 *
1355 * client.getSpace('<space_id>')
1356 * .then((space) => space.getEnvironment('<environment-id>'))
1357 * .then((environment) => environment.validateRelease({ releaseId: '<release_id>', payload: { action: 'unpublish' } }))
1358 * .catch(console.error)
1359 * ```
1360 */
1361 validateRelease({ releaseId, payload, }: {
1362 releaseId: string;
1363 payload?: ReleaseValidatePayload;
1364 }): Promise<import("./entities/release-action").ReleaseAction<any>>;
1365 /**
1366 * Archives a Release and prevents new operations (publishing, unpublishing adding new entities etc).
1367 * @param options.releaseId the ID of the release
1368 * @param options.version the version of the release that is to be archived
1369 * @returns Promise containing a wrapped Release, that has helper methods within.
1370 *
1371 * @example ```javascript
1372 * const contentful = require('contentful-management')
1373 *
1374 * const client = contentful.createClient({
1375 * accessToken: '<content_management_api_key>'
1376 * })
1377 *
1378 * client.getSpace('<space_id>')
1379 * .then((space) => space.getEnvironment('<environment-id>'))
1380 * .then((environment) => environment.archiveRelease({ releaseId: '<release_id>', version: 1 }))
1381 * .catch(console.error)
1382 * ```
1383 */
1384 archiveRelease({ releaseId, version }: {
1385 releaseId: string;
1386 version: number;
1387 }): Promise<import("./entities/release").Release>;
1388 /**
1389 * Unarchives a previously archived Release - this enables the release to be published, unpublished etc.
1390 * @param options.releaseId the ID of the release
1391 * @param options.version the version of the release that is to be unarchived
1392 * @returns Promise containing a wrapped Release, that has helper methods within.
1393 *
1394 * @example ```javascript
1395 * const contentful = require('contentful-management')
1396 *
1397 * const client = contentful.createClient({
1398 * accessToken: '<content_management_api_key>'
1399 * })
1400 *
1401 * client.getSpace('<space_id>')
1402 * .then((space) => space.getEnvironment('<environment-id>'))
1403 * .then((environment) => environment.unarchiveRelease({ releaseId: '<release_id>', version: 1 }))
1404 * .catch(console.error)
1405 * ```
1406 */
1407 unarchiveRelease({ releaseId, version }: {
1408 releaseId: string;
1409 version: number;
1410 }): Promise<import("./entities/release").Release>;
1411 /**
1412 * Retrieves a ReleaseAction by ID
1413 * @param params.releaseId The ID of a Release
1414 * @param params.actionId The ID of a Release Action
1415 * @returns Promise containing a wrapped ReleaseAction
1416 * @example ```javascript
1417 * const contentful = require('contentful-management')
1418 *
1419 * const client = contentful.createClient({
1420 * accessToken: '<content_management_api_key>'
1421 * })
1422 *
1423 * client.getSpace('<space_id>')
1424 * .then((space) => space.getEnvironment('<environment-id>'))
1425 * .then((environment) => environment.getReleaseAction({ releaseId: '<release_id>', actionId: '<action_id>' }))
1426 * .then((releaseAction) => console.log(releaseAction))
1427 * .catch(console.error)
1428 * ```
1429 */
1430 getReleaseAction({ actionId, releaseId }: {
1431 actionId: string;
1432 releaseId: string;
1433 }): Promise<import("./entities/release-action").ReleaseAction<any>>;
1434 /**
1435 * Gets a Collection of ReleaseActions
1436 * @param {string} params.releaseId ID of the Release to fetch the actions from
1437 * @param {ReleaseQueryOptions} params.query filtering options for the collection result
1438 * @returns Promise containing a wrapped ReleaseAction Collection
1439 *
1440 * @example ```javascript
1441 * const contentful = require('contentful-management')
1442 *
1443 * const client = contentful.createClient({
1444 * accessToken: '<content_management_api_key>'
1445 * })
1446 *
1447 * client.getSpace('<space_id>')
1448 * .then((space) => space.getEnvironment('<environment-id>'))
1449 * .then((environment) => environment.getReleaseActions({ query: { 'sys.id[in]': '<id_1>,<id_2>', 'sys.release.sys.id[in]': '<id1>,<id2>' } }))
1450 * .then((releaseActions) => console.log(releaseActions))
1451 * .catch(console.error)
1452 * ```
1453 */
1454 getReleaseActions({ query }: {
1455 query?: ReleaseActionQueryOptions;
1456 }): Promise<import("./common-types").Collection<import("./entities/release-action").ReleaseAction<any>, import("./entities/release-action").ReleaseActionProps<any>>>;
1457 getUIConfig(): Promise<{
1458 update: () => Promise<any & import("./entities/ui-config").UIConfigProps & {
1459 toPlainObject(): import("./entities/ui-config").UIConfigProps;
1460 }>;
1461 } & import("./entities/ui-config").UIConfigProps & {
1462 toPlainObject(): import("./entities/ui-config").UIConfigProps;
1463 }>;
1464 getUserUIConfig(): Promise<{
1465 update: () => Promise<any & import("./entities/user-ui-config").UserUIConfigProps & {
1466 toPlainObject(): import("./entities/user-ui-config").UserUIConfigProps;
1467 }>;
1468 } & import("./entities/user-ui-config").UserUIConfigProps & {
1469 toPlainObject(): import("./entities/user-ui-config").UserUIConfigProps;
1470 }>;
1471 /**
1472 * Gets a collection of all environment template installations in the environment for a given template
1473 * @param environmentTemplateId - Environment template ID to return installations for
1474 * @param [options.installationId] - Installation ID to filter for a specific installation
1475 * @return Promise for a collection of EnvironmentTemplateInstallations
1476 * ```javascript
1477 * const contentful = require('contentful-management')
1478 *
1479 * const client = contentful.createClient({
1480 * accessToken: '<content_management_api_key>'
1481 * })
1482 *
1483 * client.getSpace('<space_id>')
1484 * .then((space) => space.getEnvironment('<environment_id>'))
1485 * .then((environment) => environment.getEnvironmentTemplateInstallations('<environment_template_id>'))
1486 * .then((installations) => console.log(installations.items))
1487 * .catch(console.error)
1488 * ```
1489 */
1490 getEnvironmentTemplateInstallations(environmentTemplateId: string, { installationId, ...query }?: BasicCursorPaginationOptions & {
1491 installationId?: string;
1492 }): Promise<import("./common-types").CursorPaginatedCollection<import("./entities/environment-template-installation").EnvironmentTemplateInstallation, import("./entities/environment-template-installation").EnvironmentTemplateInstallationProps>>;
1493 /**
1494 * Gets a collection of all resource types based on native external references app installations in the environment
1495 * @param query - BasicCursorPaginationOptions
1496 * @return Promise for a collection of ResourceTypes
1497 * ```javascript
1498 * const contentful = require('contentful-management')
1499 *
1500 * const client = contentful.createClient({
1501 * accessToken: '<content_management_api_key>'
1502 * })
1503 *
1504 * client.getSpace('<space_id>')
1505 * .then((space) => space.getEnvironment('<environment_id>'))
1506 * .then((environment) => environment.getResourceTypes({limit: 10}))
1507 * .then((installations) => console.log(installations.items))
1508 * .catch(console.error)
1509 * ```
1510 */
1511 getResourceTypes(query?: BasicCursorPaginationOptions): Promise<import("./common-types").CursorPaginatedCollectionProp<import("./export-types").SpaceEnvResourceTypeProps>>;
1512 /**
1513 * Gets a collection of all resources for a given resource type based on native external references app installations in the environment
1514 * @param resourceTypeId - Id of the resourceType to get its resources
1515 * @param query - Either LookupQuery options with 'sys.urn[in]' param or a Search query with 'query' param, in both cases you can add pagination options
1516 * @return Promise for a collection of Resources for a given resourceTypeId
1517 * ```javascript
1518 * const contentful = require('contentful-management')
1519 *
1520 * const client = contentful.createClient({
1521 * accessToken: '<content_management_api_key>'
1522 * })
1523 *
1524 * // Search Query
1525 * client.getSpace('<space_id>')
1526 * .then((space) => space.getEnvironment('<environment_id>'))
1527 * // <search_query> is a string you want to search for in the external resources
1528 * .then((environment) => environment.getResourcesForResourceType('<resource_type_id>', {query: '<search_query>', limit: 10}))
1529 * .then((installations) => console.log(installations.items))
1530 * .catch(console.error)
1531 *
1532 * // Lookup query
1533 *
1534 * client.getSpace('<space_id>')
1535 * .then((space) => space.getEnvironment('<environment_id>'))
1536 * .then((environment) => environment.getResourcesForResourceType('<resource_type_id>', {'sys.urn[in]': '<resource_urn1>,<resource_urn2>', limit: 10}))
1537 * .then((installations) => console.log(installations.items))
1538 * .catch(console.error)
1539 * ```
1540 */
1541 getResourcesForResourceType(resourceTypeId: string, query?: ResourceQueryOptions): Promise<import("./common-types").CursorPaginatedCollectionProp<import("./entities/resource").ResourceProps>>;
1542};