UNPKG

2.27 kBTypeScriptView Raw
1import type { DefaultElements, MetaSysProps, MetaLinkProps, MakeRequest } from '../common-types';
2export type TeamProps = {
3 /**
4 * System metadata
5 */
6 sys: MetaSysProps & {
7 memberCount: number;
8 organization: {
9 sys: MetaLinkProps;
10 };
11 };
12 /**
13 * Name of the team
14 */
15 name: string;
16 /**
17 * Description of the team
18 */
19 description: string;
20};
21export type CreateTeamProps = Omit<TeamProps, 'sys'>;
22export interface Team extends TeamProps, DefaultElements<TeamProps> {
23 /**
24 * Deletes this object on the server.
25 * @return Promise for the deletion. It contains no data, but the Promise error case should be handled.
26 * @example ```javascript
27 * const contentful = require('contentful-management')
28 *
29 * const client = contentful.createClient({
30 * accessToken: '<content_management_api_key>'
31 * })
32 *
33 * client.getOrganization('organization_id')
34 * .then(org => org.getOrganizationMembership('organizationMembership_id'))
35 * .then((team) => {
36 * team.delete();
37 * })
38 * .catch(console.error)
39 * ```
40 */
41 delete(): Promise<void>;
42 /**
43 * Sends an update to the server with any changes made to the object's properties
44 * @return Object returned from the server with updated changes.
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.getOrganization('organization_id')
53 * .then(org => org.getTeam('team_id'))
54 * .then((team) => {
55 * team.description = 'new description';
56 * team.update();
57 * })
58 * .catch(console.error)
59 * ```
60 */
61 update(): Promise<Team>;
62}
63/**
64 * @private
65 * @param makeRequest - function to make requests via an adapter
66 * @param data - Raw team data
67 * @return Wrapped team data
68 */
69export declare function wrapTeam(makeRequest: MakeRequest, data: TeamProps): Team;
70/**
71 * @private
72 */
73export declare const wrapTeamCollection: (makeRequest: MakeRequest, data: import("../common-types").CollectionProp<TeamProps>) => import("../common-types").Collection<Team, TeamProps>;