UNPKG

36 kBTypeScriptView Raw
1/**
2 * Contentful Space API. Contains methods to access any operations at a space
3 * level, such as creating and reading entities contained in a space.
4 */
5import { MakeRequest, PaginationQueryOptions, QueryOptions } from './common-types';
6import { CreateApiKeyProps } from './entities/api-key';
7import { CreateEnvironmentProps } from './entities/environment';
8import { CreateEnvironmentAliasProps } from './entities/environment-alias';
9import { CreateRoleProps, RoleProps } from './entities/role';
10import { ScheduledActionProps, ScheduledActionQueryOptions } from './entities/scheduled-action';
11import { CreateSpaceMembershipProps } from './entities/space-membership';
12import { CreateTeamSpaceMembershipProps } from './entities/team-space-membership';
13import { CreateWebhooksProps } from './entities/webhook';
14/**
15 * @private
16 */
17export declare type ContentfulSpaceAPI = ReturnType<typeof createSpaceApi>;
18/**
19 * Creates API object with methods to access the Space API
20 * @param {MakeRequest} makeRequest - function to make requests via an adapter
21 * @return {ContentfulSpaceAPI}
22 * @private
23 */
24export default function createSpaceApi(makeRequest: MakeRequest): {
25 /**
26 * Deletes the space
27 * @return Promise for the deletion. It contains no data, but the Promise error case should be handled.
28 * @example ```javascript
29 * const contentful = require('contentful-management')
30 *
31 * const client = contentful.createClient({
32 * accessToken: '<content_management_api_key>'
33 * })
34 *
35 * client.getSpace('<space_id>')
36 * .then((space) => space.delete())
37 * .then(() => console.log('Space deleted.'))
38 * .catch(console.error)
39 * ```
40 */
41 delete: () => Promise<void>;
42 /**
43 * Updates the space
44 * @return Promise for the updated space.
45 * @example ```javascript
46 * const contentful = require('contentful-management')
47 *
48 * const client = contentful.createClient({
49 * accessToken: '<content_management_api_key>'
50 * })
51 *
52 * client.getSpace('<space_id>')
53 * .then((space) => {
54 * space.name = 'New name'
55 * return space.update()
56 * })
57 * .then((space) => console.log(`Space ${space.sys.id} renamed.`)
58 * .catch(console.error)
59 * ```
60 */
61 update: () => Promise<import("./entities/space").Space>;
62 /**
63 * Gets an environment
64 * @param id - Environment ID
65 * @return Promise for an Environment
66 * @example ```javascript
67 * const contentful = require('contentful-management')
68 *
69 * const client = contentful.createClient({
70 * accessToken: '<content_management_api_key>'
71 * })
72 *
73 * client.getSpace('<space_id>')
74 * .then((space) => space.getEnvironment('<environement_id>'))
75 * .then((environment) => console.log(environment))
76 * .catch(console.error)
77 * ```
78 */
79 getEnvironment(environmentId: string): Promise<import("./entities/environment").Environment>;
80 /**
81 * Gets a collection of Environments
82 * @return Promise for a collection of Environment
83 * @example ```javascript
84 * const contentful = require('contentful-management')
85 *
86 * const client = contentful.createClient({
87 * accessToken: '<content_management_api_key>'
88 * })
89 *
90 * client.getSpace('<space_id>')
91 * .then((space) => space.getEnvironments())
92 * .then((response) => console.log(response.items))
93 * .catch(console.error)
94 * ```
95 */
96 getEnvironments(query?: PaginationQueryOptions): Promise<import("./common-types").Collection<import("./entities/environment").Environment, import("./entities/environment").EnvironmentProps>>;
97 /**
98 * Creates an Environement
99 * @param data - Object representation of the Environment to be created
100 * @return Promise for the newly created Environment
101 * @example ```javascript
102 * const contentful = require('contentful-management')
103 *
104 * const client = contentful.createClient({
105 * accessToken: '<content_management_api_key>'
106 * })
107 *
108 * client.getSpace('<space_id>')
109 * .then((space) => space.createEnvironment({ name: 'Staging' }))
110 * .then((environment) => console.log(environment))
111 * .catch(console.error)
112 * ```
113 */
114 createEnvironment(data?: CreateEnvironmentProps): Promise<import("./entities/environment").Environment>;
115 /**
116 * Creates an Environment with a custom ID
117 * @param id - Environment ID
118 * @param data - Object representation of the Environment to be created
119 * @param sourceEnvironmentId - ID of the source environment that will be copied to create the new environment. Default is "master"
120 * @return Promise for the newly created Environment
121 * @example ```javascript
122 * const contentful = require('contentful-management')
123 *
124 * const client = contentful.createClient({
125 * accessToken: '<content_management_api_key>'
126 * })
127 *
128 * client.getSpace('<space_id>')
129 * .then((space) => space.createEnvironmentWithId('<environment-id>', { name: 'Staging'}, 'master'))
130 * .then((environment) => console.log(environment))
131 * .catch(console.error)
132 * ```
133 */
134 createEnvironmentWithId(id: string, data: CreateEnvironmentProps, sourceEnvironmentId?: string | undefined): Promise<import("./entities/environment").Environment>;
135 /**
136 * Gets a Webhook
137 * @param id - Webhook ID
138 * @return Promise for a Webhook
139 * @example ```javascript
140 * const contentful = require('contentful-management')
141 *
142 * const client = contentful.createClient({
143 * accessToken: '<content_management_api_key>'
144 * })
145 *
146 * client.getSpace('<space_id>')
147 * .then((space) => space.getWebhook('<webhook_id>'))
148 * .then((webhook) => console.log(webhook))
149 * .catch(console.error)
150 * ```
151 */
152 getWebhook(id: string): Promise<import("./entities/webhook").WebHooks>;
153 /**
154 * Gets a collection of Webhooks
155 * @return Promise for a collection of Webhooks
156 * @example ```javascript
157 * const contentful = require('contentful-management')
158 *
159 * const client = contentful.createClient({
160 * accessToken: '<content_management_api_key>'
161 * })
162 *
163 * client.getSpace('<space_id>')
164 * .then((space) => space.getWebhooks())
165 * .then((response) => console.log(response.items))
166 * .catch(console.error)
167 * ```
168 */
169 getWebhooks(): Promise<import("./common-types").Collection<import("./entities/webhook").WebHooks, import("./entities/webhook").WebhookProps>>;
170 /**
171 * Creates a Webhook
172 * @param data - Object representation of the Webhook to be created
173 * @return Promise for the newly created Webhook
174 * @example ```javascript
175 * const contentful = require('contentful-management')
176 *
177 * client.getSpace('<space_id>')
178 * .then((space) => space.createWebhook({
179 * 'name': 'My webhook',
180 * 'url': 'https://www.example.com/test',
181 * 'topics': [
182 * 'Entry.create',
183 * 'ContentType.create',
184 * '*.publish',
185 * 'Asset.*'
186 * ]
187 * }))
188 * .then((webhook) => console.log(webhook))
189 * .catch(console.error)
190 * ```
191 */
192 createWebhook(data: CreateWebhooksProps): Promise<import("./entities/webhook").WebHooks>;
193 /**
194 * Creates a Webhook with a custom ID
195 * @param id - Webhook ID
196 * @param data - Object representation of the Webhook to be created
197 * @return Promise for the newly created Webhook
198 * @example ```javascript
199 * const contentful = require('contentful-management')
200 *
201 * client.getSpace('<space_id>')
202 * .then((space) => space.createWebhookWithId('<webhook_id>', {
203 * 'name': 'My webhook',
204 * 'url': 'https://www.example.com/test',
205 * 'topics': [
206 * 'Entry.create',
207 * 'ContentType.create',
208 * '*.publish',
209 * 'Asset.*'
210 * ]
211 * }))
212 * .then((webhook) => console.log(webhook))
213 * .catch(console.error)
214 * ```
215 */
216 createWebhookWithId(id: string, data: CreateWebhooksProps): Promise<import("./entities/webhook").WebHooks>;
217 /**
218 * Gets a Role
219 * @param id - Role ID
220 * @return Promise for a Role
221 * @example ```javascript
222 * const contentful = require('contentful-management')
223 *
224 * const client = contentful.createClient({
225 * accessToken: '<content_management_api_key>'
226 * })
227 *
228 * client.getSpace('<space_id>')
229 * .then((space) => space.createRole({
230 * fields: {
231 * title: {
232 * 'en-US': 'Role title'
233 * }
234 * }
235 * }))
236 * .then((role) => console.log(role))
237 * .catch(console.error)
238 * ```
239 */
240 getRole(id: string): Promise<import("./entities/role").Role>;
241 /**
242 * Gets a collection of Roles
243 * @return Promise for a collection of Roles
244 * @example ```javascript
245 * const contentful = require('contentful-management')
246 *
247 * const client = contentful.createClient({
248 * accessToken: '<content_management_api_key>'
249 * })
250 *
251 * client.getSpace('<space_id>')
252 * .then((space) => space.getRoles())
253 * .then((response) => console.log(response.items))
254 * .catch(console.error)
255 * ```
256 */
257 getRoles(query?: QueryOptions): Promise<import("./common-types").Collection<import("./entities/role").Role, RoleProps>>;
258 /**
259 * Creates a Role
260 * @param data - Object representation of the Role to be created
261 * @return Promise for the newly created Role
262 * @example ```javascript
263 * const contentful = require('contentful-management')
264 *
265 * const client = contentful.createClient({
266 * accessToken: '<content_management_api_key>'
267 * })
268 * client.getSpace('<space_id>')
269 * .then((space) => space.createRole({
270 * name: 'My Role',
271 * description: 'foobar role',
272 * permissions: {
273 * ContentDelivery: 'all',
274 * ContentModel: ['read'],
275 * Settings: []
276 * },
277 * policies: [
278 * {
279 * effect: 'allow',
280 * actions: 'all',
281 * constraint: {
282 * and: [
283 * {
284 * equals: [
285 * { doc: 'sys.type' },
286 * 'Entry'
287 * ]
288 * },
289 * {
290 * equals: [
291 * { doc: 'sys.type' },
292 * 'Asset'
293 * ]
294 * }
295 * ]
296 * }
297 * }
298 * ]
299 * }))
300 * .then((role) => console.log(role))
301 * .catch(console.error)
302 * ```
303 */
304 createRole(data: CreateRoleProps): Promise<import("./entities/role").Role>;
305 /**
306 * Creates a Role with a custom ID
307 * @param id - Role ID
308 * @param data - Object representation of the Role to be created
309 * @return Promise for the newly created Role
310 * @example ```javascript
311 * const contentful = require('contentful-management')
312 *
313 * const client = contentful.createClient({
314 * accessToken: '<content_management_api_key>'
315 * })
316 * client.getSpace('<space_id>')
317 * .then((space) => space.createRoleWithId('<role-id>', {
318 * name: 'My Role',
319 * description: 'foobar role',
320 * permissions: {
321 * ContentDelivery: 'all',
322 * ContentModel: ['read'],
323 * Settings: []
324 * },
325 * policies: [
326 * {
327 * effect: 'allow',
328 * actions: 'all',
329 * constraint: {
330 * and: [
331 * {
332 * equals: [
333 * { doc: 'sys.type' },
334 * 'Entry'
335 * ]
336 * },
337 * {
338 * equals: [
339 * { doc: 'sys.type' },
340 * 'Asset'
341 * ]
342 * }
343 * ]
344 * }
345 * }
346 * ]
347 * }))
348 * .then((role) => console.log(role))
349 * .catch(console.error)
350 * ```
351 */
352 createRoleWithId(id: string, roleData: Omit<RoleProps, 'sys'>): Promise<import("./entities/role").Role>;
353 /**
354 * Gets a User
355 * @param userId - User ID
356 * @return Promise for a User
357 * @example ```javascript
358 * const contentful = require('contentful-management')
359 *
360 * client.getSpace('<space_id>')
361 * .then((space) => space.getSpaceUser('id'))
362 * .then((user) => console.log(user))
363 * .catch(console.error)
364 * ```
365 */
366 getSpaceUser(userId: string): Promise<import("./export-types").UserProps & {
367 toPlainObject(): import("./export-types").UserProps;
368 }>;
369 /**
370 * Gets a collection of Users in a space
371 * @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.
372 * @return Promise a collection of Users in a space
373 * @example ```javascript
374 * const contentful = require('contentful-management')
375 *
376 * client.getSpace('<space_id>')
377 * .then((space) => space.getSpaceUsers(query))
378 * .then((data) => console.log(data))
379 * .catch(console.error)
380 * ```
381 */
382 getSpaceUsers(query?: QueryOptions): Promise<import("./common-types").Collection<import("./export-types").UserProps & {
383 toPlainObject(): import("./export-types").UserProps;
384 }, import("./export-types").UserProps>>;
385 /**
386 * Gets a collection of teams for a space
387 * @param query
388 * @return Promise for a collection of teams for a space
389 * @example ```javascript
390 * const contentful = require('contentful-management')
391 *
392 * client.getSpace('<space_id>')
393 * .then((space) => space.getTeams())
394 * .then((teamsCollection) => console.log(teamsCollection))
395 * .catch(console.error)
396 * ```
397 */
398 getTeams(query?: QueryOptions): Promise<import("./common-types").Collection<import("./export-types").Team, import("./export-types").TeamProps>>;
399 /**
400 * Gets a Space Member
401 * @param id Get Space Member by user_id
402 * @return Promise for a Space Member
403 * @example ```javascript
404 * const contentful = require('contentful-management')
405 *
406 * client.getSpace('<space_id>')
407 * .then((space) => space.getSpaceMember(id))
408 * .then((spaceMember) => console.log(spaceMember))
409 * .catch(console.error)
410 * ```
411 */
412 getSpaceMember(id: string): Promise<import("./export-types").SpaceMemberProps & {
413 toPlainObject(): import("./export-types").SpaceMemberProps;
414 }>;
415 /**
416 * Gets a collection of Space Members
417 * @param query
418 * @return Promise for a collection of Space Members
419 * @example ```javascript
420 * const contentful = require('contentful-management')
421 *
422 * client.getSpace('<space_id>')
423 * .then((space) => space.getSpaceMembers({'limit': 100}))
424 * .then((spaceMemberCollection) => console.log(spaceMemberCollection))
425 * .catch(console.error)
426 * ```
427 */
428 getSpaceMembers(query?: QueryOptions): Promise<import("./common-types").Collection<import("./export-types").SpaceMemberProps & {
429 toPlainObject(): import("./export-types").SpaceMemberProps;
430 }, import("./export-types").SpaceMemberProps>>;
431 /**
432 * Gets a Space Membership
433 * Warning: the user attribute in the space membership root is deprecated. The attribute has been moved inside the sys object (i.e. sys.user).
434 * @param id - Space Membership ID
435 * @return Promise for a Space Membership
436 * @example ```javascript
437 * const contentful = require('contentful-management')
438 *
439 * client.getSpace('<space_id>')
440 * .then((space) => space.getSpaceMembership('id'))
441 * .then((spaceMembership) => console.log(spaceMembership))
442 * .catch(console.error)
443 * ```
444 */
445 getSpaceMembership(id: string): Promise<import("./entities/space-membership").SpaceMembership>;
446 /**
447 * Gets a collection of Space Memberships
448 * Warning: the user attribute in the space membership root is deprecated. The attribute has been moved inside the sys object (i.e. sys.user).
449 * @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.
450 * @return Promise for a collection of Space Memberships
451 * @example ```javascript
452 * const contentful = require('contentful-management')
453 *
454 * client.getSpace('<space_id>')
455 * .then((space) => space.getSpaceMemberships({'limit': 100})) // you can add more queries as 'key': 'value'
456 * .then((response) => console.log(response.items))
457 * .catch(console.error)
458 * ```
459 */
460 getSpaceMemberships(query?: QueryOptions): Promise<import("./common-types").Collection<import("./entities/space-membership").SpaceMembership, import("./entities/space-membership").SpaceMembershipProps>>;
461 /**
462 * Creates a Space Membership
463 * Warning: the user attribute in the space membership root is deprecated. The attribute has been moved inside the sys object (i.e. sys.user).
464 * @param data - Object representation of the Space Membership to be created
465 * @return Promise for the newly created Space Membership
466 * @example ```javascript
467 * const contentful = require('contentful-management')
468 *
469 * const client = contentful.createClient({
470 * accessToken: '<content_management_api_key>'
471 * })
472 *
473 * client.getSpace('<space_id>')
474 * .then((space) => space.createSpaceMembership({
475 * admin: false,
476 * roles: [
477 * {
478 * type: 'Link',
479 * linkType: 'Role',
480 * id: '<role_id>'
481 * }
482 * ],
483 * email: 'foo@example.com'
484 * }))
485 * .then((spaceMembership) => console.log(spaceMembership))
486 * .catch(console.error)
487 * ```
488 */
489 createSpaceMembership(data: CreateSpaceMembershipProps): Promise<import("./entities/space-membership").SpaceMembership>;
490 /**
491 * Creates a Space Membership with a custom ID
492 * Warning: the user attribute in the space membership root is deprecated. The attribute has been moved inside the sys object (i.e. sys.user).
493 * @param id - Space Membership ID
494 * @param data - Object representation of the Space Membership to be created
495 * @return Promise for the newly created Space Membership
496 * @example ```javascript
497 * const contentful = require('contentful-management')
498 *
499 * const client = contentful.createClient({
500 * accessToken: '<content_management_api_key>'
501 * })
502 *
503 * client.getSpace('<space_id>')
504 * .then((space) => space.createSpaceMembershipWithId('<space-membership-id>', {
505 * admin: false,
506 * roles: [
507 * {
508 * type: 'Link',
509 * linkType: 'Role',
510 * id: '<role_id>'
511 * }
512 * ],
513 * email: 'foo@example.com'
514 * }))
515 * .then((spaceMembership) => console.log(spaceMembership))
516 * .catch(console.error)
517 * ```
518 */
519 createSpaceMembershipWithId(id: string, data: CreateSpaceMembershipProps): Promise<import("./entities/space-membership").SpaceMembership>;
520 /**
521 * Gets a Team Space Membership
522 * @param id - Team Space Membership ID
523 * @return Promise for a Team Space Membership
524 * @example ```javascript
525 * const contentful = require('contentful-management')
526 *
527 * client.getSpace('<space_id>')
528 * .then((space) => space.getTeamSpaceMembership('team_space_membership_id'))
529 * .then((teamSpaceMembership) => console.log(teamSpaceMembership))
530 * .catch(console.error)
531 * ```
532 */
533 getTeamSpaceMembership(teamSpaceMembershipId: string): Promise<import("./entities/team-space-membership").TeamSpaceMembership>;
534 /**
535 * Gets a collection of Team Space Memberships
536 * @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.
537 * @return Promise for a collection of Team Space Memberships
538 * @example ```javascript
539 * const contentful = require('contentful-management')
540 *
541 * client.getSpace('<space_id>')
542 * .then((space) => space.getTeamSpaceMemberships())
543 * .then((response) => console.log(response.items))
544 * .catch(console.error)
545 * ```
546 */
547 getTeamSpaceMemberships(query?: QueryOptions): Promise<import("./common-types").Collection<import("./entities/team-space-membership").TeamSpaceMembership, import("./entities/team-space-membership").TeamSpaceMembershipProps>>;
548 /**
549 * Creates a Team Space Membership
550 * @param id - Team ID
551 * @param data - Object representation of the Team Space Membership to be created
552 * @return Promise for the newly created Team Space Membership
553 * @example ```javascript
554 * const contentful = require('contentful-management')
555 *
556 * const client = contentful.createClient({
557 * accessToken: '<content_management_api_key>'
558 * })
559 *
560 * client.getSpace('<space_id>')
561 * .then((space) => space.createTeamSpaceMembership('team_id', {
562 * admin: false,
563 * roles: [
564 * {
565 sys: {
566 * type: 'Link',
567 * linkType: 'Role',
568 * id: '<role_id>'
569 * }
570 * }
571 * ],
572 * }))
573 * .then((teamSpaceMembership) => console.log(teamSpaceMembership))
574 * .catch(console.error)
575 * ```
576 */
577 createTeamSpaceMembership(teamId: string, data: CreateTeamSpaceMembershipProps): Promise<import("./entities/team-space-membership").TeamSpaceMembership>;
578 /**
579 * Gets a Api Key
580 * @param id - API Key ID
581 * @return Promise for a Api Key
582 * @example ```javascript
583 * const contentful = require('contentful-management')
584 *
585 * const client = contentful.createClient({
586 * accessToken: '<content_management_api_key>'
587 * })
588 *
589 * client.getSpace('<space_id>')
590 * .then((space) => space.getApiKey('<apikey-id>'))
591 * .then((apikey) => console.log(apikey))
592 * .catch(console.error)
593 * ```
594 */
595 getApiKey(id: string): Promise<import("./entities/api-key").ApiKey>;
596 /**
597 * Gets a collection of Api Keys
598 * @return Promise for a collection of Api Keys
599 * @example ```javascript
600 * const contentful = require('contentful-management')
601 *
602 * const client = contentful.createClient({
603 * accessToken: '<content_management_api_key>'
604 * })
605 *
606 * client.getSpace('<space_id>')
607 * .then((space) => space.getApiKeys())
608 * .then((response) => console.log(response.items))
609 * .catch(console.error)
610 * ```
611 */
612 getApiKeys(): Promise<import("./common-types").Collection<import("./entities/api-key").ApiKey, import("./entities/api-key").ApiKeyProps>>;
613 /**
614 * Gets a collection of preview Api Keys
615 * @return Promise for a collection of Preview Api Keys
616 * @example ```javascript
617 * const contentful = require('contentful-management')
618 *
619 * const client = contentful.createClient({
620 * accessToken: '<content_management_api_key>'
621 * })
622 *
623 * client.getSpace('<space_id>')
624 * .then((space) => space.getPreviewApiKeys())
625 * .then((response) => console.log(response.items))
626 * .catch(console.error)
627 * ```
628 */
629 getPreviewApiKeys(): Promise<import("./common-types").Collection<import("./export-types").PreviewApiKey, import("./export-types").PreviewApiKeyProps>>;
630 /**
631 * Gets a preview Api Key
632 * @param id - Preview API Key ID
633 * @return Promise for a Preview Api Key
634 * @example ```javascript
635 * const contentful = require('contentful-management')
636 *
637 * const client = contentful.createClient({
638 * accessToken: '<content_management_api_key>'
639 * })
640 *
641 * client.getSpace('<space_id>')
642 * .then((space) => space.getPreviewApiKey('<preview-apikey-id>'))
643 * .then((previewApikey) => console.log(previewApikey))
644 * .catch(console.error)
645 * ```
646 */
647 getPreviewApiKey(id: string): Promise<import("./export-types").PreviewApiKey>;
648 /**
649 * Creates a Api Key
650 * @param payload - Object representation of the Api Key to be created
651 * @return Promise for the newly created Api Key
652 * @example ```javascript
653 * const contentful = require('contentful-management')
654 *
655 * const client = contentful.createClient({
656 * accessToken: '<content_management_api_key>'
657 * })
658 *
659 * client.getSpace('<space_id>')
660 * .then((space) => space.createApiKey({
661 * name: 'API Key name',
662 * environments:[
663 * {
664 * sys: {
665 * type: 'Link'
666 * linkType: 'Environment',
667 * id:'<environment_id>'
668 * }
669 * }
670 * ]
671 * }
672 * }))
673 * .then((apiKey) => console.log(apiKey))
674 * .catch(console.error)
675 * ```
676 */
677 createApiKey: (payload: CreateApiKeyProps) => Promise<import("./entities/api-key").ApiKey>;
678 /**
679 * Creates a Api Key with a custom ID
680 * @param id - Api Key ID
681 * @param payload - Object representation of the Api Key to be created
682 * @return Promise for the newly created Api Key
683 * @example ```javascript
684 * const contentful = require('contentful-management')
685 *
686 * const client = contentful.createClient({
687 * accessToken: '<content_management_api_key>'
688 * })
689 *
690 * client.getSpace('<space_id>')
691 * .then((space) => space.createApiKeyWithId('<api-key-id>', {
692 * name: 'API Key name'
693 * environments:[
694 * {
695 * sys: {
696 * type: 'Link'
697 * linkType: 'Environment',
698 * id:'<environment_id>'
699 * }
700 * }
701 * ]
702 * }
703 * }))
704 * .then((apiKey) => console.log(apiKey))
705 * .catch(console.error)
706 * ```
707 */
708 createApiKeyWithId(id: string, payload: CreateApiKeyProps): Promise<import("./entities/api-key").ApiKey>;
709 /**
710 * Creates an EnvironmentAlias with a custom ID
711 * @param environmentAliasId - EnvironmentAlias ID
712 * @param data - Object representation of the EnvironmentAlias to be created
713 * @return Promise for the newly created EnvironmentAlias
714 * @example ```javascript
715 * const contentful = require('contentful-management')
716 *
717 * const client = contentful.createClient({
718 * accessToken: '<content_management_api_key>'
719 * })
720 *
721 * client.getSpace('<space_id>')
722 * .then((space) => space.createEnvironmentAliasWithId('<environment-alias-id>', {
723 * environment: {
724 * sys: { type: 'Link', linkType: 'Environment', id: 'targetEnvironment' }
725 * }
726 * }))
727 * .then((environmentAlias) => console.log(environmentAlias))
728 * .catch(console.error)
729 * ```
730 */
731 createEnvironmentAliasWithId(environmentAliasId: string, data: CreateEnvironmentAliasProps): Promise<import("./entities/environment-alias").EnvironmentAlias>;
732 /**
733 * Gets an Environment Alias
734 * @param Environment Alias ID
735 * @return Promise for an Environment Alias
736 * @example ```javascript
737 * const contentful = require('contentful-management')
738 *
739 * const client = contentful.createClient({
740 * accessToken: '<content_management_api_key>'
741 * })
742 *
743 * client.getSpace('<space_id>')
744 * .then((space) => space.getEnvironmentAlias('<alias-id>'))
745 * .then((alias) => console.log(alias))
746 * .catch(console.error)
747 * ```
748 */
749 getEnvironmentAlias(environmentAliasId: string): Promise<import("./entities/environment-alias").EnvironmentAlias>;
750 /**
751 * Gets a collection of Environment Aliases
752 * @return Promise for a collection of Environment Aliases
753 * @example ```javascript
754 * const contentful = require('contentful-management')
755 *
756 * const client = contentful.createClient({
757 * accessToken: '<content_management_api_key>'
758 * })
759 *
760 * client.getSpace('<space_id>')
761 * .then((space) => space.getEnvironmentAliases()
762 * .then((response) => console.log(response.items))
763 * .catch(console.error)
764 * ```
765 */
766 getEnvironmentAliases(): Promise<import("./common-types").Collection<import("./entities/environment-alias").EnvironmentAlias, import("./entities/environment-alias").EnvironmentAliasProps>>;
767 /**
768 * Query for scheduled actions in space.
769 * @param query - Object with search parameters. The enviroment id field is mandatory. Check the <a href="https://www.contentful.com/developers/docs/references/content-management-api/#/reference/scheduled-actions/scheduled-actions-collection">REST API reference</a> for more details.
770 * @return Promise for the scheduled actions query
771 *
772 * @example ```javascript
773 * const contentful = require('contentful-management');
774 *
775 * const client = contentful.createClient({
776 * accessToken: '<content_management_api_key>'
777 * })
778 *
779 * client.getSpace('<space_id>')
780 * .then((space) => space.getScheduledActions({
781 * 'environment.sys.id': '<environment_id>',
782 * 'sys.status': 'scheduled'
783 * }))
784 * .then((scheduledActionCollection) => console.log(scheduledActionCollection.items))
785 * .catch(console.error)
786 * ```
787 */
788 getScheduledActions(query: ScheduledActionQueryOptions): Promise<import("./common-types").Collection<import("./entities/scheduled-action").ScheduledAction, ScheduledActionProps>>;
789 /**
790 * Get a Scheduled Action in the current space by environment and ID.
791 *
792 * @throws if the Scheduled Action cannot be found or the user doesn't have permission to read schedules from the entity of the scheduled action itself.
793 * @returns Promise with the Scheduled Action
794 * @example ```javascript
795 * const contentful = require('contentful-management');
796 *
797 * const client = contentful.createClient({
798 * accessToken: '<content_management_api_key>'
799 * })
800 *
801 * client.getSpace('<space_id>')
802 * .then((space) => space.getScheduledAction({
803 * scheduledActionId: '<scheduled-action-id>',
804 * environmentId: '<environmentId>'
805 * }))
806 * .then((scheduledAction) => console.log(scheduledAction))
807 * .catch(console.error)
808 * ```
809 */
810 getScheduledAction({ scheduledActionId, environmentId, }: {
811 scheduledActionId: string;
812 environmentId: string;
813 }): Promise<import("./entities/scheduled-action").ScheduledAction>;
814 /**
815 * Creates a scheduled action
816 * @param data - Object representation of the scheduled action to be created
817 * @return Promise for the newly created scheduled actions
818 * @example ```javascript
819 * const contentful = require('contentful-management');
820 *
821 * const client = contentful.createClient({
822 * accessToken: '<content_management_api_key>'
823 * })
824 *
825 * client.getSpace('<space_id>')
826 * .then((space) => space.createScheduledAction({
827 * entity: {
828 * sys: {
829 * type: 'Link',
830 * linkType: 'Entry',
831 * id: '<entry_id>'
832 * }
833 * },
834 * environment: {
835 * sys: {
836 * type: 'Link',
837 * linkType: 'Environment',
838 * id: '<environment_id>'
839 * }
840 * },
841 * action: 'publish',
842 * scheduledFor: {
843 * datetime: <ISO_date_string>,
844 * timezone: 'Europe/Berlin'
845 * }
846 * }))
847 * .then((scheduledAction) => console.log(scheduledAction))
848 * .catch(console.error)
849 * ```
850 */
851 createScheduledAction(data: Omit<ScheduledActionProps, 'sys'>): Promise<import("./entities/scheduled-action").ScheduledAction>;
852 /**
853 * Update a scheduled action
854 * @param {object} options
855 * @param options.scheduledActionId the id of the scheduled action to update
856 * @param options.version the sys.version of the scheduled action to be updated
857 * @param payload the scheduled actions object with updates, omitting sys object
858 * @returns Promise containing a wrapped scheduled action with helper methods
859 * @example ```javascript
860 * const contentful = require('contentful-management');
861 *
862 * const client = contentful.createClient({
863 * accessToken: '<content_management_api_key>'
864 * })
865 *
866 * client.getSpace('<space_id>')
867 * .then((space) => {
868 * return space.createScheduledAction({
869 * entity: {
870 * sys: {
871 * type: 'Link',
872 * linkType: 'Entry',
873 * id: '<entry_id>'
874 * }
875 * },
876 * environment: {
877 * sys: {
878 * type: 'Link',
879 * linkType: 'Environment',
880 * id: '<environment_id>'
881 * }
882 * },
883 * action: 'publish',
884 * scheduledFor: {
885 * datetime: <ISO_date_string>,
886 * timezone: 'Europe/Berlin'
887 * }
888 * })
889 * .then((scheduledAction) => {
890 * const { _sys, ...payload } = scheduledAction;
891 * return space.updateScheduledAction({
892 * ...payload,
893 * scheduledFor: {
894 * ...payload.scheduledFor,
895 * timezone: 'Europe/Paris'
896 * }
897 * })
898 * })
899 * .then((scheduledAction) => console.log(scheduledAction))
900 * .catch(console.error);
901 * ```
902 */
903 updateScheduledAction({ scheduledActionId, payload, version, }: {
904 scheduledActionId: string;
905 payload: Omit<ScheduledActionProps, 'sys'>;
906 version: number;
907 }): Promise<import("./entities/scheduled-action").ScheduledAction>;
908 /**
909 * Cancels a Scheduled Action.
910 * Only cancels actions that have not yet executed.
911 *
912 * @param {object} options
913 * @param options.scheduledActionId the id of the scheduled action to be canceled
914 * @param options.environmentId the environment ID of the scheduled action to be canceled
915 * @throws if the Scheduled Action cannot be found or the user doesn't have permissions in the entity in the action.
916 * @returns Promise containing a wrapped Scheduled Action with helper methods
917 * @example ```javascript
918 * const contentful = require('contentful-management');
919 *
920 * const client = contentful.createClient({
921 * accessToken: '<content_management_api_key>'
922 * })
923 *
924 * // Given that an Scheduled Action is scheduled
925 * client.getSpace('<space_id>')
926 * .then((space) => space.deleteScheduledAction({
927 * environmentId: '<environment-id>',
928 * scheduledActionId: '<scheduled-action-id>'
929 * }))
930 * // The scheduled Action sys.status is now 'canceled'
931 * .then((scheduledAction) => console.log(scheduledAction))
932 * .catch(console.error);
933 * ```
934 */
935 deleteScheduledAction({ scheduledActionId, environmentId, }: {
936 scheduledActionId: string;
937 environmentId: string;
938 }): Promise<import("./entities/scheduled-action").ScheduledAction>;
939};