UNPKG

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