UNPKG

2.6 kBTypeScriptView Raw
1import type { DefaultElements, MetaSysProps, MetaLinkProps, MakeRequest } from '../common-types';
2export type TeamMembershipProps = {
3 /**
4 * System metadata
5 */
6 sys: MetaSysProps & {
7 team: {
8 sys: MetaLinkProps;
9 };
10 organization: {
11 sys: MetaLinkProps;
12 };
13 organizationMembership: {
14 sys: MetaLinkProps;
15 };
16 };
17 /**
18 * Is admin
19 */
20 admin: boolean;
21 /**
22 * Organization membership id
23 */
24 organizationMembershipId: string;
25};
26export type CreateTeamMembershipProps = Omit<TeamMembershipProps, 'sys'>;
27export interface TeamMembership extends TeamMembershipProps, DefaultElements<TeamMembershipProps> {
28 /**
29 * Deletes this object on the server.
30 * @return Promise for the deletion. It contains no data, but the Promise error case should be handled.
31 * @example ```javascript
32 * const contentful = require('contentful-management')
33 *
34 * const client = contentful.createClient({
35 * accessToken: '<content_management_api_key>'
36 * })
37 *
38 * client.getOrganization('organizationId')
39 * .then(org => org.getTeamMembership('teamId', 'teamMembershipId'))
40 * .then((teamMembership) => {
41 * teamMembership.delete();
42 * })
43 * .catch(console.error)
44 * ```
45 */
46 delete(): Promise<void>;
47 /**
48 * Sends an update to the server with any changes made to the object's properties
49 * @return Object returned from the server with updated changes.
50 * @example ```javascript
51 * const contentful = require('contentful-management')
52 *
53 * const client = contentful.createClient({
54 * accessToken: '<content_management_api_key>'
55 * })
56 *
57 * client.getOrganization('organizationId')
58 * .then(org => org.getTeamMembership('teamId', 'teamMembershipId'))
59 * .then((teamMembership) => {
60 * teamMembership.admin = true;
61 * teamMembership.update();
62 * })
63 * .catch(console.error)
64 * ```
65 */
66 update(): Promise<TeamMembership>;
67}
68/**
69 * @private
70 * @param makeRequest - function to make requests via an adapter
71 * @param data - Raw team membership data
72 * @return Wrapped team membership data
73 */
74export declare function wrapTeamMembership(makeRequest: MakeRequest, data: TeamMembershipProps): TeamMembership;
75/**
76 * @private
77 */
78export declare const wrapTeamMembershipCollection: (makeRequest: MakeRequest, data: import("../common-types").CollectionProp<TeamMembershipProps>) => import("../common-types").Collection<TeamMembership, TeamMembershipProps>;