UNPKG

2.48 kBTypeScriptView Raw
1import type { SysLink, MetaSysProps, DefaultElements, MakeRequest } from '../common-types';
2export type SpaceMembershipProps = {
3 sys: MetaSysProps & {
4 space: SysLink;
5 user: SysLink;
6 };
7 user: SysLink;
8 admin: boolean;
9 roles: SysLink[];
10};
11export type CreateSpaceMembershipProps = Omit<SpaceMembershipProps, 'sys' | 'user'> & {
12 email: string;
13};
14export interface SpaceMembership extends SpaceMembershipProps, DefaultElements<SpaceMembershipProps> {
15 /**
16 * Deletes this object on the server.
17 * @return Promise for the deletion. It contains no data, but the Promise error case should be handled.
18 * @example ```javascript
19 * const contentful = require('contentful-management')
20 *
21 * const client = contentful.createClient({
22 * accessToken: '<content_management_api_key>'
23 * })
24 *
25 * client.getSpace('<space_id>')
26 * .then((space) => space.getSpaceMembership('<spaceMembership_id>'))
27 * .then((spaceMembership) => spaceMembership.delete())
28 * .then(() => console.log(`spaceMembership deleted.`))
29 * .catch(console.error)
30 * ```
31 */
32 delete(): Promise<void>;
33 /**
34 * Sends an update to the server with any changes made to the object's properties
35 * @return Object returned from the server with updated changes.
36 * @example ```javascript
37 * const contentful = require('contentful-management')
38 *
39 * const client = contentful.createClient({
40 * accessToken: '<content_management_api_key>'
41 * })
42 *
43 * client.getSpace('<space_id>')
44 * .then((space) => space.getSpaceMembership('<spaceMembership_id>'))
45 * .then((spaceMembership) => {
46 * spaceMembership.name = 'new space membership name'
47 * })
48 * .then((spaceMembership) => console.log(`spaceMembership ${spaceMembership.sys.id} updated.`))
49 * .catch(console.error)
50 * ```
51 */
52 update(): Promise<SpaceMembership>;
53}
54/**
55 * @private
56 * @param makeRequest - function to make requests via an adapter
57 * @param data - Raw space membership data
58 * @return Wrapped space membership data
59 */
60export declare function wrapSpaceMembership(makeRequest: MakeRequest, data: SpaceMembershipProps): SpaceMembership;
61/**
62 * @private
63 */
64export declare const wrapSpaceMembershipCollection: (makeRequest: MakeRequest, data: import("../common-types").CollectionProp<SpaceMembershipProps>) => import("../common-types").Collection<SpaceMembership, SpaceMembershipProps>;