UNPKG

40.3 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 type { MakeRequest, PaginationQueryOptions, QueryOptions } from './common-types';
6import type { CreateApiKeyProps } from './entities/api-key';
7import type { CreateEnvironmentProps } from './entities/environment';
8import type { CreateEnvironmentAliasProps } from './entities/environment-alias';
9import type { CreateRoleProps, RoleProps } from './entities/role';
10import type { ScheduledActionProps, ScheduledActionQueryOptions } from './entities/scheduled-action';
11import type { CreateSpaceMembershipProps } from './entities/space-membership';
12import type { CreateTeamSpaceMembershipProps } from './entities/team-space-membership';
13import type { CreateWebhooksProps, UpsertWebhookSigningSecretPayload, WebhookRetryPolicyPayload } from './entities/webhook';
14/**
15 * @private
16 */
17export 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('<environment_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 environment
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): 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 * Fetch a webhook signing secret
172 * @returns Promise for the redacted webhook signing secret in this space
173 * @example ```javascript
174 * const contentful = require('contentful-management')
175 *
176 * const client = contentful.createClient({
177 * accessToken: '<content_management_api_key>'
178 * })
179 *
180 * client.getSpace('<space_id>')
181 * .then((space) => space.getWebhookSigningSecret())
182 * .then((response) => console.log(response.redactedValue))
183 * .catch(console.error)
184 * ```
185 */
186 getWebhookSigningSecret: () => Promise<import("./entities/webhook").WebhookSigningSecretProps>;
187 /**
188 * Fetch a webhook retry policy
189 * @returns Promise for the redacted webhook retry policy in this space
190 * @example ```javascript
191 * const contentful = require('contentful-management')
192 *
193 * const client = contentful.createClient({
194 * accessToken: '<content_management_api_key>'
195 * })
196 *
197 * client.getSpace('<space_id>')
198 * .then((space) => space.getRetryPolicy())
199 * .then((response) => console.log(response.redactedValue))
200 * .catch(console.error)
201 * ```
202 */
203 getWebhookRetryPolicy: () => Promise<import("./entities/webhook").WebhookRetryPolicyProps>;
204 /**
205 * Creates a Webhook
206 * @param data - Object representation of the Webhook to be created
207 * @return Promise for the newly created Webhook
208 * @example ```javascript
209 * const contentful = require('contentful-management')
210 *
211 * client.getSpace('<space_id>')
212 * .then((space) => space.createWebhook({
213 * 'name': 'My webhook',
214 * 'url': 'https://www.example.com/test',
215 * 'topics': [
216 * 'Entry.create',
217 * 'ContentType.create',
218 * '*.publish',
219 * 'Asset.*'
220 * ]
221 * }))
222 * .then((webhook) => console.log(webhook))
223 * .catch(console.error)
224 * ```
225 */
226 createWebhook(data: CreateWebhooksProps): Promise<import("./entities/webhook").WebHooks>;
227 /**
228 * Creates a Webhook with a custom ID
229 * @param id - Webhook ID
230 * @param data - Object representation of the Webhook to be created
231 * @return Promise for the newly created Webhook
232 * @example ```javascript
233 * const contentful = require('contentful-management')
234 *
235 * client.getSpace('<space_id>')
236 * .then((space) => space.createWebhookWithId('<webhook_id>', {
237 * 'name': 'My webhook',
238 * 'url': 'https://www.example.com/test',
239 * 'topics': [
240 * 'Entry.create',
241 * 'ContentType.create',
242 * '*.publish',
243 * 'Asset.*'
244 * ]
245 * }))
246 * .then((webhook) => console.log(webhook))
247 * .catch(console.error)
248 * ```
249 */
250 createWebhookWithId(id: string, data: CreateWebhooksProps): Promise<import("./entities/webhook").WebHooks>;
251 /**
252 * Create or update the webhook signing secret for this space
253 * @param data 64 character string that will be used to sign the webhook calls
254 * @returns Promise for the redacted webhook signing secret that was created or updated
255 * @example ```javascript
256 * const contentful = require('contentful-management')
257 * const crypto = require('crypto')
258 *
259 * const client = contentful.createClient({
260 * accessToken: '<content_management_api_key>'
261 * })
262 *
263 * const signingSecret = client.getSpace('<space_id>')
264 * .then((space) => space.upsertWebhookSigningSecret({
265 * value: crypto.randomBytes(32).toString('hex')
266 * }))
267 * .then((response) => console.log(response.redactedValue))
268 * .catch(console.error)
269 * ```
270 */
271 upsertWebhookSigningSecret: (data: UpsertWebhookSigningSecretPayload) => Promise<import("./entities/webhook").WebhookSigningSecretProps>;
272 /**
273 * Create or update the webhook retry policy for this space
274 * @param data the maxRetries with integer value >= 2 and <= 99 value to set in the Retry Policy
275 * @returns Promise for the redacted webhook retry policy that was created or updated
276 * @example ```javascript
277 * const contentful = require('contentful-management')
278 *
279 * const client = contentful.createClient({
280 * accessToken: '<content_management_api_key>'
281 * })
282 *
283 * const retryPolicy = client.getSpace('<space_id>')
284 * .then((space) => space.upsertWebhookRetryPolicy({
285 * maxRetries: 15
286 * }))
287 * .then((response) => console.log(response.redactedValue))
288 * .catch(console.error)
289 * ```
290 */
291 upsertWebhookRetryPolicy: (data: WebhookRetryPolicyPayload) => Promise<import("./entities/webhook").WebhookRetryPolicyProps>;
292 /**
293 * Delete the webhook signing secret for this space
294 * @returns Promise<void>
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.deleteWebhookSigningSecret())
304 * .then(() => console.log("success"))
305 * .catch(console.error)
306 * ```
307 */
308 deleteWebhookSigningSecret: () => Promise<void>;
309 /**
310 * Delete the webhook retry policy for this space
311 * @returns Promise<void>
312 * @example ```javascript
313 * const contentful = require('contentful-management')
314 *
315 * const client = contentful.createClient({
316 * accessToken: '<content_management_api_key>'
317 * })
318 *
319 * client.getSpace('<space_id>')
320 * .then((space) => space.deleteWebhookRetryPolicy())
321 * .then(() => console.log("success"))
322 * .catch(console.error)
323 * ```
324 */
325 deleteWebhookRetryPolicy: () => Promise<void>;
326 /**
327 * Gets a Role
328 * @param id - Role ID
329 * @return Promise for a Role
330 * @example ```javascript
331 * const contentful = require('contentful-management')
332 *
333 * const client = contentful.createClient({
334 * accessToken: '<content_management_api_key>'
335 * })
336 *
337 * client.getSpace('<space_id>')
338 * .then((space) => space.createRole({
339 * fields: {
340 * title: {
341 * 'en-US': 'Role title'
342 * }
343 * }
344 * }))
345 * .then((role) => console.log(role))
346 * .catch(console.error)
347 * ```
348 */
349 getRole(id: string): Promise<import("./entities/role").Role>;
350 /**
351 * Gets a collection of Roles
352 * @return Promise for a collection of Roles
353 * @example ```javascript
354 * const contentful = require('contentful-management')
355 *
356 * const client = contentful.createClient({
357 * accessToken: '<content_management_api_key>'
358 * })
359 *
360 * client.getSpace('<space_id>')
361 * .then((space) => space.getRoles())
362 * .then((response) => console.log(response.items))
363 * .catch(console.error)
364 * ```
365 */
366 getRoles(query?: QueryOptions): Promise<import("./common-types").Collection<import("./entities/role").Role, RoleProps>>;
367 /**
368 * Creates a Role
369 * @param data - Object representation of the Role to be created
370 * @return Promise for the newly created Role
371 * @example ```javascript
372 * const contentful = require('contentful-management')
373 *
374 * const client = contentful.createClient({
375 * accessToken: '<content_management_api_key>'
376 * })
377 * client.getSpace('<space_id>')
378 * .then((space) => space.createRole({
379 * name: 'My Role',
380 * description: 'foobar role',
381 * permissions: {
382 * ContentDelivery: 'all',
383 * ContentModel: ['read'],
384 * Settings: []
385 * },
386 * policies: [
387 * {
388 * effect: 'allow',
389 * actions: 'all',
390 * constraint: {
391 * and: [
392 * {
393 * equals: [
394 * { doc: 'sys.type' },
395 * 'Entry'
396 * ]
397 * },
398 * {
399 * equals: [
400 * { doc: 'sys.type' },
401 * 'Asset'
402 * ]
403 * }
404 * ]
405 * }
406 * }
407 * ]
408 * }))
409 * .then((role) => console.log(role))
410 * .catch(console.error)
411 * ```
412 */
413 createRole(data: CreateRoleProps): Promise<import("./entities/role").Role>;
414 /**
415 * Creates a Role with a custom ID
416 * @param id - Role ID
417 * @param data - Object representation of the Role to be created
418 * @return Promise for the newly created Role
419 * @example ```javascript
420 * const contentful = require('contentful-management')
421 *
422 * const client = contentful.createClient({
423 * accessToken: '<content_management_api_key>'
424 * })
425 * client.getSpace('<space_id>')
426 * .then((space) => space.createRoleWithId('<role-id>', {
427 * name: 'My Role',
428 * description: 'foobar role',
429 * permissions: {
430 * ContentDelivery: 'all',
431 * ContentModel: ['read'],
432 * Settings: []
433 * },
434 * policies: [
435 * {
436 * effect: 'allow',
437 * actions: 'all',
438 * constraint: {
439 * and: [
440 * {
441 * equals: [
442 * { doc: 'sys.type' },
443 * 'Entry'
444 * ]
445 * },
446 * {
447 * equals: [
448 * { doc: 'sys.type' },
449 * 'Asset'
450 * ]
451 * }
452 * ]
453 * }
454 * }
455 * ]
456 * }))
457 * .then((role) => console.log(role))
458 * .catch(console.error)
459 * ```
460 */
461 createRoleWithId(id: string, roleData: Omit<RoleProps, "sys">): Promise<import("./entities/role").Role>;
462 /**
463 * Gets a User
464 * @param userId - User ID
465 * @return Promise for a User
466 * @example ```javascript
467 * const contentful = require('contentful-management')
468 *
469 * client.getSpace('<space_id>')
470 * .then((space) => space.getSpaceUser('id'))
471 * .then((user) => console.log(user))
472 * .catch(console.error)
473 * ```
474 */
475 getSpaceUser(userId: string): Promise<import("./export-types").UserProps & {
476 toPlainObject(): import("./export-types").UserProps;
477 }>;
478 /**
479 * Gets a collection of Users in a space
480 * @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.
481 * @return Promise a collection of Users in a space
482 * @example ```javascript
483 * const contentful = require('contentful-management')
484 *
485 * client.getSpace('<space_id>')
486 * .then((space) => space.getSpaceUsers(query))
487 * .then((data) => console.log(data))
488 * .catch(console.error)
489 * ```
490 */
491 getSpaceUsers(query?: QueryOptions): Promise<import("./common-types").Collection<import("./export-types").UserProps & {
492 toPlainObject(): import("./export-types").UserProps;
493 }, import("./export-types").UserProps>>;
494 /**
495 * Gets a collection of teams for a space
496 * @param query
497 * @return Promise for a collection of teams for a space
498 * @example ```javascript
499 * const contentful = require('contentful-management')
500 *
501 * client.getSpace('<space_id>')
502 * .then((space) => space.getTeams())
503 * .then((teamsCollection) => console.log(teamsCollection))
504 * .catch(console.error)
505 * ```
506 */
507 getTeams(query?: QueryOptions): Promise<import("./common-types").Collection<import("./export-types").Team, import("./export-types").TeamProps>>;
508 /**
509 * Gets a Space Member
510 * @param id Get Space Member by user_id
511 * @return Promise for a Space Member
512 * @example ```javascript
513 * const contentful = require('contentful-management')
514 *
515 * client.getSpace('<space_id>')
516 * .then((space) => space.getSpaceMember(id))
517 * .then((spaceMember) => console.log(spaceMember))
518 * .catch(console.error)
519 * ```
520 */
521 getSpaceMember(id: string): Promise<import("./export-types").SpaceMemberProps & {
522 toPlainObject(): import("./export-types").SpaceMemberProps;
523 }>;
524 /**
525 * Gets a collection of Space Members
526 * @param query
527 * @return Promise for a collection of Space Members
528 * @example ```javascript
529 * const contentful = require('contentful-management')
530 *
531 * client.getSpace('<space_id>')
532 * .then((space) => space.getSpaceMembers({'limit': 100}))
533 * .then((spaceMemberCollection) => console.log(spaceMemberCollection))
534 * .catch(console.error)
535 * ```
536 */
537 getSpaceMembers(query?: QueryOptions): Promise<import("./common-types").Collection<import("./export-types").SpaceMemberProps & {
538 toPlainObject(): import("./export-types").SpaceMemberProps;
539 }, import("./export-types").SpaceMemberProps>>;
540 /**
541 * Gets a Space Membership
542 * Warning: the user attribute in the space membership root is deprecated. The attribute has been moved inside the sys object (i.e. sys.user).
543 * @param id - Space Membership ID
544 * @return Promise for a Space Membership
545 * @example ```javascript
546 * const contentful = require('contentful-management')
547 *
548 * client.getSpace('<space_id>')
549 * .then((space) => space.getSpaceMembership('id'))
550 * .then((spaceMembership) => console.log(spaceMembership))
551 * .catch(console.error)
552 * ```
553 */
554 getSpaceMembership(id: string): Promise<import("./entities/space-membership").SpaceMembership>;
555 /**
556 * Gets a collection of Space Memberships
557 * Warning: the user attribute in the space membership root is deprecated. The attribute has been moved inside the sys object (i.e. sys.user).
558 * @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.
559 * @return Promise for a collection of Space Memberships
560 * @example ```javascript
561 * const contentful = require('contentful-management')
562 *
563 * client.getSpace('<space_id>')
564 * .then((space) => space.getSpaceMemberships({'limit': 100})) // you can add more queries as 'key': 'value'
565 * .then((response) => console.log(response.items))
566 * .catch(console.error)
567 * ```
568 */
569 getSpaceMemberships(query?: QueryOptions): Promise<import("./common-types").Collection<import("./entities/space-membership").SpaceMembership, import("./entities/space-membership").SpaceMembershipProps>>;
570 /**
571 * Creates a Space Membership
572 * Warning: the user attribute in the space membership root is deprecated. The attribute has been moved inside the sys object (i.e. sys.user).
573 * @param data - Object representation of the Space Membership to be created
574 * @return Promise for the newly created Space Membership
575 * @example ```javascript
576 * const contentful = require('contentful-management')
577 *
578 * const client = contentful.createClient({
579 * accessToken: '<content_management_api_key>'
580 * })
581 *
582 * client.getSpace('<space_id>')
583 * .then((space) => space.createSpaceMembership({
584 * admin: false,
585 * roles: [
586 * {
587 * type: 'Link',
588 * linkType: 'Role',
589 * id: '<role_id>'
590 * }
591 * ],
592 * email: 'foo@example.com'
593 * }))
594 * .then((spaceMembership) => console.log(spaceMembership))
595 * .catch(console.error)
596 * ```
597 */
598 createSpaceMembership(data: CreateSpaceMembershipProps): Promise<import("./entities/space-membership").SpaceMembership>;
599 /**
600 * Creates a Space Membership with a custom ID
601 * Warning: the user attribute in the space membership root is deprecated. The attribute has been moved inside the sys object (i.e. sys.user).
602 * @param id - Space Membership ID
603 * @param data - Object representation of the Space Membership to be created
604 * @return Promise for the newly created Space Membership
605 * @example ```javascript
606 * const contentful = require('contentful-management')
607 *
608 * const client = contentful.createClient({
609 * accessToken: '<content_management_api_key>'
610 * })
611 *
612 * client.getSpace('<space_id>')
613 * .then((space) => space.createSpaceMembershipWithId('<space-membership-id>', {
614 * admin: false,
615 * roles: [
616 * {
617 * type: 'Link',
618 * linkType: 'Role',
619 * id: '<role_id>'
620 * }
621 * ],
622 * email: 'foo@example.com'
623 * }))
624 * .then((spaceMembership) => console.log(spaceMembership))
625 * .catch(console.error)
626 * ```
627 */
628 createSpaceMembershipWithId(id: string, data: CreateSpaceMembershipProps): Promise<import("./entities/space-membership").SpaceMembership>;
629 /**
630 * Gets a Team Space Membership
631 * @param id - Team Space Membership ID
632 * @return Promise for a Team Space Membership
633 * @example ```javascript
634 * const contentful = require('contentful-management')
635 *
636 * client.getSpace('<space_id>')
637 * .then((space) => space.getTeamSpaceMembership('team_space_membership_id'))
638 * .then((teamSpaceMembership) => console.log(teamSpaceMembership))
639 * .catch(console.error)
640 * ```
641 */
642 getTeamSpaceMembership(teamSpaceMembershipId: string): Promise<import("./entities/team-space-membership").TeamSpaceMembership>;
643 /**
644 * Gets a collection of Team Space Memberships
645 * @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.
646 * @return Promise for a collection of Team Space Memberships
647 * @example ```javascript
648 * const contentful = require('contentful-management')
649 *
650 * client.getSpace('<space_id>')
651 * .then((space) => space.getTeamSpaceMemberships())
652 * .then((response) => console.log(response.items))
653 * .catch(console.error)
654 * ```
655 */
656 getTeamSpaceMemberships(query?: QueryOptions): Promise<import("./common-types").Collection<import("./entities/team-space-membership").TeamSpaceMembership, import("./entities/team-space-membership").TeamSpaceMembershipProps>>;
657 /**
658 * Creates a Team Space Membership
659 * @param id - Team ID
660 * @param data - Object representation of the Team Space Membership to be created
661 * @return Promise for the newly created Team Space Membership
662 * @example ```javascript
663 * const contentful = require('contentful-management')
664 *
665 * const client = contentful.createClient({
666 * accessToken: '<content_management_api_key>'
667 * })
668 *
669 * client.getSpace('<space_id>')
670 * .then((space) => space.createTeamSpaceMembership('team_id', {
671 * admin: false,
672 * roles: [
673 * {
674 sys: {
675 * type: 'Link',
676 * linkType: 'Role',
677 * id: '<role_id>'
678 * }
679 * }
680 * ],
681 * }))
682 * .then((teamSpaceMembership) => console.log(teamSpaceMembership))
683 * .catch(console.error)
684 * ```
685 */
686 createTeamSpaceMembership(teamId: string, data: CreateTeamSpaceMembershipProps): Promise<import("./entities/team-space-membership").TeamSpaceMembership>;
687 /**
688 * Gets a Api Key
689 * @param id - API Key ID
690 * @return Promise for a Api Key
691 * @example ```javascript
692 * const contentful = require('contentful-management')
693 *
694 * const client = contentful.createClient({
695 * accessToken: '<content_management_api_key>'
696 * })
697 *
698 * client.getSpace('<space_id>')
699 * .then((space) => space.getApiKey('<apikey-id>'))
700 * .then((apikey) => console.log(apikey))
701 * .catch(console.error)
702 * ```
703 */
704 getApiKey(id: string): Promise<import("./entities/api-key").ApiKey>;
705 /**
706 * Gets a collection of Api Keys
707 * @return Promise for a collection of Api Keys
708 * @example ```javascript
709 * const contentful = require('contentful-management')
710 *
711 * const client = contentful.createClient({
712 * accessToken: '<content_management_api_key>'
713 * })
714 *
715 * client.getSpace('<space_id>')
716 * .then((space) => space.getApiKeys())
717 * .then((response) => console.log(response.items))
718 * .catch(console.error)
719 * ```
720 */
721 getApiKeys(): Promise<import("./common-types").Collection<import("./entities/api-key").ApiKey, import("./entities/api-key").ApiKeyProps>>;
722 /**
723 * Gets a collection of preview Api Keys
724 * @return Promise for a collection of Preview Api Keys
725 * @example ```javascript
726 * const contentful = require('contentful-management')
727 *
728 * const client = contentful.createClient({
729 * accessToken: '<content_management_api_key>'
730 * })
731 *
732 * client.getSpace('<space_id>')
733 * .then((space) => space.getPreviewApiKeys())
734 * .then((response) => console.log(response.items))
735 * .catch(console.error)
736 * ```
737 */
738 getPreviewApiKeys(): Promise<import("./common-types").Collection<import("./export-types").PreviewApiKey, import("./export-types").PreviewApiKeyProps>>;
739 /**
740 * Gets a preview Api Key
741 * @param id - Preview API Key ID
742 * @return Promise for a Preview Api Key
743 * @example ```javascript
744 * const contentful = require('contentful-management')
745 *
746 * const client = contentful.createClient({
747 * accessToken: '<content_management_api_key>'
748 * })
749 *
750 * client.getSpace('<space_id>')
751 * .then((space) => space.getPreviewApiKey('<preview-apikey-id>'))
752 * .then((previewApikey) => console.log(previewApikey))
753 * .catch(console.error)
754 * ```
755 */
756 getPreviewApiKey(id: string): Promise<import("./export-types").PreviewApiKey>;
757 /**
758 * Creates a Api Key
759 * @param payload - Object representation of the Api Key to be created
760 * @return Promise for the newly created Api Key
761 * @example ```javascript
762 * const contentful = require('contentful-management')
763 *
764 * const client = contentful.createClient({
765 * accessToken: '<content_management_api_key>'
766 * })
767 *
768 * client.getSpace('<space_id>')
769 * .then((space) => space.createApiKey({
770 * name: 'API Key name',
771 * environments:[
772 * {
773 * sys: {
774 * type: 'Link'
775 * linkType: 'Environment',
776 * id:'<environment_id>'
777 * }
778 * }
779 * ]
780 * }
781 * }))
782 * .then((apiKey) => console.log(apiKey))
783 * .catch(console.error)
784 * ```
785 */
786 createApiKey: (payload: CreateApiKeyProps) => Promise<import("./entities/api-key").ApiKey>;
787 /**
788 * Creates a Api Key with a custom ID
789 * @param id - Api Key ID
790 * @param payload - Object representation of the Api Key to be created
791 * @return Promise for the newly created Api Key
792 * @example ```javascript
793 * const contentful = require('contentful-management')
794 *
795 * const client = contentful.createClient({
796 * accessToken: '<content_management_api_key>'
797 * })
798 *
799 * client.getSpace('<space_id>')
800 * .then((space) => space.createApiKeyWithId('<api-key-id>', {
801 * name: 'API Key name'
802 * environments:[
803 * {
804 * sys: {
805 * type: 'Link'
806 * linkType: 'Environment',
807 * id:'<environment_id>'
808 * }
809 * }
810 * ]
811 * }
812 * }))
813 * .then((apiKey) => console.log(apiKey))
814 * .catch(console.error)
815 * ```
816 */
817 createApiKeyWithId(id: string, payload: CreateApiKeyProps): Promise<import("./entities/api-key").ApiKey>;
818 /**
819 * Creates an EnvironmentAlias with a custom ID
820 * @param environmentAliasId - EnvironmentAlias ID
821 * @param data - Object representation of the EnvironmentAlias to be created
822 * @return Promise for the newly created EnvironmentAlias
823 * @example ```javascript
824 * const contentful = require('contentful-management')
825 *
826 * const client = contentful.createClient({
827 * accessToken: '<content_management_api_key>'
828 * })
829 *
830 * client.getSpace('<space_id>')
831 * .then((space) => space.createEnvironmentAliasWithId('<environment-alias-id>', {
832 * environment: {
833 * sys: { type: 'Link', linkType: 'Environment', id: 'targetEnvironment' }
834 * }
835 * }))
836 * .then((environmentAlias) => console.log(environmentAlias))
837 * .catch(console.error)
838 * ```
839 */
840 createEnvironmentAliasWithId(environmentAliasId: string, data: CreateEnvironmentAliasProps): Promise<import("./entities/environment-alias").EnvironmentAlias>;
841 /**
842 * Gets an Environment Alias
843 * @param Environment Alias ID
844 * @return Promise for an Environment Alias
845 * @example ```javascript
846 * const contentful = require('contentful-management')
847 *
848 * const client = contentful.createClient({
849 * accessToken: '<content_management_api_key>'
850 * })
851 *
852 * client.getSpace('<space_id>')
853 * .then((space) => space.getEnvironmentAlias('<alias-id>'))
854 * .then((alias) => console.log(alias))
855 * .catch(console.error)
856 * ```
857 */
858 getEnvironmentAlias(environmentAliasId: string): Promise<import("./entities/environment-alias").EnvironmentAlias>;
859 /**
860 * Gets a collection of Environment Aliases
861 * @return Promise for a collection of Environment Aliases
862 * @example ```javascript
863 * const contentful = require('contentful-management')
864 *
865 * const client = contentful.createClient({
866 * accessToken: '<content_management_api_key>'
867 * })
868 *
869 * client.getSpace('<space_id>')
870 * .then((space) => space.getEnvironmentAliases()
871 * .then((response) => console.log(response.items))
872 * .catch(console.error)
873 * ```
874 */
875 getEnvironmentAliases(): Promise<import("./common-types").Collection<import("./entities/environment-alias").EnvironmentAlias, import("./entities/environment-alias").EnvironmentAliasProps>>;
876 /**
877 * Query for scheduled actions in space.
878 * @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.
879 * @return Promise for the scheduled actions query
880 *
881 * @example ```javascript
882 * const contentful = require('contentful-management');
883 *
884 * const client = contentful.createClient({
885 * accessToken: '<content_management_api_key>'
886 * })
887 *
888 * client.getSpace('<space_id>')
889 * .then((space) => space.getScheduledActions({
890 * 'environment.sys.id': '<environment_id>',
891 * 'sys.status': 'scheduled'
892 * }))
893 * .then((scheduledActionCollection) => console.log(scheduledActionCollection.items))
894 * .catch(console.error)
895 * ```
896 */
897 getScheduledActions(query: ScheduledActionQueryOptions): Promise<import("./common-types").Collection<import("./entities/scheduled-action").ScheduledAction, ScheduledActionProps>>;
898 /**
899 * Get a Scheduled Action in the current space by environment and ID.
900 *
901 * @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.
902 * @returns Promise with the Scheduled Action
903 * @example ```javascript
904 * const contentful = require('contentful-management');
905 *
906 * const client = contentful.createClient({
907 * accessToken: '<content_management_api_key>'
908 * })
909 *
910 * client.getSpace('<space_id>')
911 * .then((space) => space.getScheduledAction({
912 * scheduledActionId: '<scheduled-action-id>',
913 * environmentId: '<environmentId>'
914 * }))
915 * .then((scheduledAction) => console.log(scheduledAction))
916 * .catch(console.error)
917 * ```
918 */
919 getScheduledAction({ scheduledActionId, environmentId, }: {
920 scheduledActionId: string;
921 environmentId: string;
922 }): Promise<import("./entities/scheduled-action").ScheduledAction>;
923 /**
924 * Creates a scheduled action
925 * @param data - Object representation of the scheduled action to be created
926 * @return Promise for the newly created scheduled actions
927 * @example ```javascript
928 * const contentful = require('contentful-management');
929 *
930 * const client = contentful.createClient({
931 * accessToken: '<content_management_api_key>'
932 * })
933 *
934 * client.getSpace('<space_id>')
935 * .then((space) => space.createScheduledAction({
936 * entity: {
937 * sys: {
938 * type: 'Link',
939 * linkType: 'Entry',
940 * id: '<entry_id>'
941 * }
942 * },
943 * environment: {
944 * sys: {
945 * type: 'Link',
946 * linkType: 'Environment',
947 * id: '<environment_id>'
948 * }
949 * },
950 * action: 'publish',
951 * scheduledFor: {
952 * datetime: <ISO_date_string>,
953 * timezone: 'Europe/Berlin'
954 * }
955 * }))
956 * .then((scheduledAction) => console.log(scheduledAction))
957 * .catch(console.error)
958 * ```
959 */
960 createScheduledAction(data: Omit<ScheduledActionProps, "sys">): Promise<import("./entities/scheduled-action").ScheduledAction>;
961 /**
962 * Update a scheduled action
963 * @param {object} options
964 * @param options.scheduledActionId the id of the scheduled action to update
965 * @param options.version the sys.version of the scheduled action to be updated
966 * @param payload the scheduled actions object with updates, omitting sys object
967 * @returns Promise containing a wrapped scheduled action with helper methods
968 * @example ```javascript
969 * const contentful = require('contentful-management');
970 *
971 * const client = contentful.createClient({
972 * accessToken: '<content_management_api_key>'
973 * })
974 *
975 * client.getSpace('<space_id>')
976 * .then((space) => {
977 * return space.createScheduledAction({
978 * entity: {
979 * sys: {
980 * type: 'Link',
981 * linkType: 'Entry',
982 * id: '<entry_id>'
983 * }
984 * },
985 * environment: {
986 * sys: {
987 * type: 'Link',
988 * linkType: 'Environment',
989 * id: '<environment_id>'
990 * }
991 * },
992 * action: 'publish',
993 * scheduledFor: {
994 * datetime: <ISO_date_string>,
995 * timezone: 'Europe/Berlin'
996 * }
997 * })
998 * .then((scheduledAction) => {
999 * const { _sys, ...payload } = scheduledAction;
1000 * return space.updateScheduledAction({
1001 * ...payload,
1002 * scheduledFor: {
1003 * ...payload.scheduledFor,
1004 * timezone: 'Europe/Paris'
1005 * }
1006 * })
1007 * })
1008 * .then((scheduledAction) => console.log(scheduledAction))
1009 * .catch(console.error);
1010 * ```
1011 */
1012 updateScheduledAction({ scheduledActionId, payload, version, }: {
1013 scheduledActionId: string;
1014 payload: Omit<ScheduledActionProps, "sys">;
1015 version: number;
1016 }): Promise<import("./entities/scheduled-action").ScheduledAction>;
1017 /**
1018 * Cancels a Scheduled Action.
1019 * Only cancels actions that have not yet executed.
1020 *
1021 * @param {object} options
1022 * @param options.scheduledActionId the id of the scheduled action to be canceled
1023 * @param options.environmentId the environment ID of the scheduled action to be canceled
1024 * @throws if the Scheduled Action cannot be found or the user doesn't have permissions in the entity in the action.
1025 * @returns Promise containing a wrapped Scheduled Action with helper methods
1026 * @example ```javascript
1027 * const contentful = require('contentful-management');
1028 *
1029 * const client = contentful.createClient({
1030 * accessToken: '<content_management_api_key>'
1031 * })
1032 *
1033 * // Given that an Scheduled Action is scheduled
1034 * client.getSpace('<space_id>')
1035 * .then((space) => space.deleteScheduledAction({
1036 * environmentId: '<environment-id>',
1037 * scheduledActionId: '<scheduled-action-id>'
1038 * }))
1039 * // The scheduled Action sys.status is now 'canceled'
1040 * .then((scheduledAction) => console.log(scheduledAction))
1041 * .catch(console.error);
1042 * ```
1043 */
1044 deleteScheduledAction({ scheduledActionId, environmentId, }: {
1045 scheduledActionId: string;
1046 environmentId: string;
1047 }): Promise<import("./entities/scheduled-action").ScheduledAction>;
1048};