UNPKG

2.96 kBTypeScriptView Raw
1import type { DefaultElements, MakeRequest, MetaLinkProps, MetaSysProps, QueryOptions } from '../common-types';
2export interface Options {
3 teamId?: string;
4 query?: QueryOptions;
5}
6export type TeamSpaceMembershipProps = {
7 /**
8 * System metadata
9 */
10 sys: MetaSysProps & {
11 team: {
12 sys: MetaLinkProps;
13 };
14 space: {
15 sys: MetaLinkProps;
16 };
17 };
18 /**
19 * Is admin
20 */
21 admin: boolean;
22 /**
23 * Roles
24 */
25 roles: {
26 sys: MetaLinkProps;
27 }[];
28};
29export type CreateTeamSpaceMembershipProps = Omit<TeamSpaceMembershipProps, 'sys'>;
30export interface TeamSpaceMembership extends TeamSpaceMembershipProps, DefaultElements<TeamSpaceMembershipProps> {
31 /**
32 * Deletes this object on the server.
33 * @return Promise for the deletion. It contains no data, but the Promise error case should be handled.
34 * @example ```javascript
35 * const contentful = require('contentful-management')
36 *
37 * const client = contentful.createClient({
38 * accessToken: '<content_management_api_key>'
39 * })
40 *
41 * client.getSpace('<space_id>')
42 * .then((space) => space.getTeamSpaceMembership('<team_space_membership_id>'))
43 * .then((teamSpaceMembership) => teamSpaceMembership.delete())
44 * .then(() => console.log(`spaceMembership deleted.`))
45 * .catch(console.error)
46 * ```
47 */
48 delete(): Promise<void>;
49 /**
50 * Sends an update to the server with any changes made to the object's properties
51 * @return Object returned from the server with updated changes.
52 * @example ```javascript
53 * const contentful = require('contentful-management')
54 *
55 * const client = contentful.createClient({
56 * accessToken: '<content_management_api_key>'
57 * })
58 *
59 * client.getSpace('<space_id>')
60 * .then((space) => space.getTeamSpaceMembership('team_space_membership_id'))
61 * .then((teamSpaceMembership) => {
62 * item.roles = [
63 * {
64 * sys: {
65 * type: 'Link',
66 * linkType: 'Role',
67 * id: 'role_id'
68 * }
69 * }
70 * ]
71 * })
72 * .then((spaceMembership) => console.log(`spaceMembership ${spaceMembership.sys.id} updated.`))
73 * .catch(console.error)
74 * ```
75 */
76 update(): Promise<TeamSpaceMembership>;
77}
78/**
79 * @private
80 * @param makeRequest - function to make requests via an adapter
81 * @param data - Raw space membership data
82 * @return Wrapped team space membership data
83 */
84export declare function wrapTeamSpaceMembership(makeRequest: MakeRequest, data: TeamSpaceMembershipProps): TeamSpaceMembership;
85/**
86 * @private
87 */
88export declare const wrapTeamSpaceMembershipCollection: (makeRequest: MakeRequest, data: import("../common-types").CollectionProp<TeamSpaceMembershipProps>) => import("../common-types").Collection<TeamSpaceMembership, TeamSpaceMembershipProps>;