UNPKG

3.67 kBTypeScriptView Raw
1import type { RawAxiosRequestHeaders } from 'axios';
2import type { GetTeamParams, GetOrganizationParams, QueryParams, CollectionProp, GetSpaceParams } from '../../common-types';
3import type { TeamProps, CreateTeamProps } from '../../export-types';
4import type { OptionalDefaults } from '../wrappers/wrap';
5export type TeamPlainClientAPI = {
6 /**
7 * Fetch a single team by its ID
8 * @param params the team and organization IDs
9 * @returns the requested team
10 * @throws if the request fails, or the team or organization is not found
11 * @example
12 * ```javascript
13 * const team = await client.team.get({
14 * organizationId: '<organization_id>',
15 * teamId: '<team_id>'
16 * })
17 * ```
18 */
19 get(params: OptionalDefaults<GetTeamParams>): Promise<TeamProps>;
20 /**
21 * Fetch all teams for a given organization
22 * @param params the organization ID and optional pagination query parameters
23 * @returns A collection of teams
24 * @throws if the request fails, or the organization is not found
25 * @example
26 * ```javascript
27 * const teams = await client.team.getMany({
28 * organizationId: '<organization_id>',
29 * query: {
30 * limit: 10,
31 * }
32 * })
33 * ```
34 */
35 getMany(params: OptionalDefaults<GetOrganizationParams & QueryParams>): Promise<CollectionProp<TeamProps>>;
36 /**
37 * Fetch all teams for a given space
38 * @param params the space ID and optional pagination query parameters
39 * @returns A collection of teams
40 * @throws if the request fails, or the space is not found
41 * @example
42 * ```javascript
43 * const teams = await client.team.getManyForSpace({
44 * spaceId: '<space_id>',
45 * query: {
46 * limit: 10,
47 * }
48 * })
49 * ```
50 */
51 getManyForSpace(params: OptionalDefaults<GetSpaceParams & QueryParams>): Promise<CollectionProp<TeamProps>>;
52 /**
53 * Create a new team
54 * @param params the organization ID
55 * @param rawData the team name and description
56 * @returns the created team
57 * @throws if the request fails, or the organization is not found
58 * @example
59 * ```javascript
60 * const team = await client.team.create({
61 * organizationId: '<organization_id>',
62 * }, {
63 * name: 'My Team',
64 * description: 'A team for my organization',
65 * })
66 * ```
67 */
68 create(params: OptionalDefaults<GetOrganizationParams>, rawData: CreateTeamProps, headers?: RawAxiosRequestHeaders): Promise<any>;
69 /**
70 * Update a team
71 * @param params the organization and team IDs
72 * @param rawData the team data
73 * @returns the updated team
74 * @throws if the request fails, or the organization or team are not found
75 * @example
76 * ```javascript
77 * let team = await client.team.get({
78 * organizationId: '<organization_id>',
79 * teamId: '<team_id>'
80 * })
81 *
82 * team = await client.team.update({
83 * organizationId: '<organization_id>',
84 * teamId: '<team_id>'
85 * }, {
86 * ...team,
87 * name: 'New team name',
88 * })
89 * ```
90 */
91 update(params: OptionalDefaults<GetTeamParams>, rawData: TeamProps, headers?: RawAxiosRequestHeaders): Promise<TeamProps>;
92 /**
93 * Delete a team
94 * @param params the organization and team IDs
95 * @throws if the request fails, or the organization or team are not found
96 * @example
97 * ```javascript
98 * await client.team.delete({
99 * organizationId: '<organization_id>',
100 * teamId: '<team_id>'
101 * })
102 * ```
103 */
104 delete(params: OptionalDefaults<GetTeamParams>): Promise<void>;
105};