1 | import type { RawAxiosRequestHeaders } from 'axios';
|
2 | import type { GetSpaceMembershipProps, GetSpaceParams, QueryParams, CollectionProp, GetOrganizationParams } from '../../common-types';
|
3 | import type { OptionalDefaults } from '../wrappers/wrap';
|
4 | import type { CreateSpaceMembershipProps, SpaceMembershipProps } from '../../entities/space-membership';
|
5 | export type SpaceMembershipPlainClientAPI = {
|
6 | /**
|
7 | * Fetches a space membership for a given space
|
8 | * @param params the space and membership IDs
|
9 | * @returns the space membership
|
10 | * @throws if the request fails, or the space membership is not found
|
11 | * @example ```javascript
|
12 | * const spaceMembership = await client.spaceMembership.get({
|
13 | * spaceId: '<space_id>',
|
14 | * spaceMembershipId: '<membership_id>',
|
15 | * });
|
16 | * ```
|
17 | */
|
18 | get(params: OptionalDefaults<GetSpaceMembershipProps>): Promise<SpaceMembershipProps>;
|
19 | /**
|
20 | * Fetches all of the memberships for a given space
|
21 | * @param params a space ID
|
22 | * @returns a collection of space memberships
|
23 | * @throws if the request fails, the space is not found, or the query parameters are malformed
|
24 | * @example ```javascript
|
25 | * const spaceMemberships = await client.spaceMembership.getMany({
|
26 | * spaceId: '<space_id>',
|
27 | * spaceMembershipId: '<membership_id>',
|
28 | * });
|
29 | * ```
|
30 | */
|
31 | getMany(params: OptionalDefaults<GetSpaceParams & QueryParams>): Promise<CollectionProp<SpaceMembershipProps>>;
|
32 | /**
|
33 | * Fetches the space membership within a given organization
|
34 | * @param params the organization and membership IDs
|
35 | * @returns the space membership
|
36 | * @throws if the request fails, or the organization or the space membership is not found
|
37 | * @example ```javascript
|
38 | * const spaceMembership = await client.spaceMembership.getForOrganization({
|
39 | * spaceId: '<space_id>',
|
40 | * spaceMembershipId: '<membership_id>',
|
41 | * });
|
42 | * ```
|
43 | */
|
44 | getForOrganization(params: OptionalDefaults<GetOrganizationParams & {
|
45 | spaceMembershipId: string;
|
46 | }>): Promise<SpaceMembershipProps>;
|
47 | /**
|
48 | * Fetches all of the space memberships within a given organization
|
49 | * @param params the organization and query parameterss
|
50 | * @returns a collection of space memberships
|
51 | * @throws if the request fails, the organization is not found, or the query parameters are malformed
|
52 | * @example ```javascript
|
53 | * const spaceMemberships = await client.spaceMembership.getManyForOrganization({
|
54 | * organizationId: '<organization_id>',
|
55 | * spaceMembershipId: '<membership_id>',
|
56 | * });
|
57 | * ```
|
58 | */
|
59 | getManyForOrganization(params: OptionalDefaults<GetOrganizationParams & QueryParams>): Promise<CollectionProp<SpaceMembershipProps>>;
|
60 | /**
|
61 | * Creates a space membership
|
62 | * @param params the space ID
|
63 | * @param data the space membership data
|
64 | * @returns the created space membership
|
65 | * @throws if the request fails, the space cannot be found, or the data is malformed
|
66 | * @example ```javascript
|
67 | * const spaceMembership = await client.spaceMembership.create(
|
68 | * {
|
69 | * spaceId: '<space_id>',
|
70 | * },
|
71 | * {
|
72 | * admin: false,
|
73 | * roles: [
|
74 | * {
|
75 | * sys: {
|
76 | * type: 'Link',
|
77 | * linkType: 'Role',
|
78 | * id: '<role_id>',
|
79 | * },
|
80 | * },
|
81 | * ],
|
82 | * email: 'foo@example.com',
|
83 | * }
|
84 | * );
|
85 | * ```
|
86 | */
|
87 | create(params: OptionalDefaults<GetSpaceParams>, data: CreateSpaceMembershipProps, headers?: RawAxiosRequestHeaders): Promise<SpaceMembershipProps>;
|
88 | /**
|
89 | * Creates a space membership with a specific ID
|
90 | * @param params the space ID and chosen membership ID
|
91 | * @param data the space membership data
|
92 | * @returns the created space membership
|
93 | * @throws if the request fails, the space cannot be found, or the data is malformed
|
94 | * @example ```javascript
|
95 | * const spaceMembership = await client.spaceMembership.createWithId(
|
96 | * {
|
97 | * spaceId: '<space_id>',
|
98 | * spaceMembershipId: '<membership_id>',
|
99 | * },
|
100 | * {
|
101 | * admin: false,
|
102 | * roles: [
|
103 | * {
|
104 | * sys: {
|
105 | * type: 'Link',
|
106 | * linkType: 'Role',
|
107 | * id: '<role_id>',
|
108 | * },
|
109 | * },
|
110 | * ],
|
111 | * email: 'foo@example.com',
|
112 | * }
|
113 | * );
|
114 | * ```
|
115 | */
|
116 | createWithId(params: OptionalDefaults<GetSpaceMembershipProps>, data: CreateSpaceMembershipProps, headers?: RawAxiosRequestHeaders): Promise<SpaceMembershipProps>;
|
117 | /**
|
118 | * Updates a space membership
|
119 | * @param params the space and membership IDs
|
120 | * @param rawData the space membership update
|
121 | * @returns the updated space membership
|
122 | * @throws if the request fails, the space membership is not found, or the payload is malformed
|
123 | * @example ```javascript
|
124 | * let spaceMembership = await client.spaceMembership.get({
|
125 | * spaceId: '<space_id>',
|
126 | * spaceMembershipId: '<membership_id>',
|
127 | * });
|
128 | *
|
129 | * spaceMembership = await client.spaceMembership.update(
|
130 | * {
|
131 | * spaceId: '<space_id>',
|
132 | * spaceMembershipId: '<membership_id>',
|
133 | * },
|
134 | * {
|
135 | * ...spaceMembership,
|
136 | * admin: true,
|
137 | * }
|
138 | * );
|
139 | * ```
|
140 | */
|
141 | update(params: OptionalDefaults<GetSpaceMembershipProps>, rawData: SpaceMembershipProps, headers?: RawAxiosRequestHeaders): Promise<SpaceMembershipProps>;
|
142 | /**
|
143 | * Deletes a space membership
|
144 | * @param params the space and membership IDs
|
145 | * @returns void
|
146 | * @throws if the request fails, or the space membership is not found
|
147 | * @example ```javascript
|
148 | * await client.spaceMembership.delete({
|
149 | * spaceId: '<space_id>',
|
150 | * spaceMembershipId: '<membership_id>',
|
151 | * });
|
152 | * ```
|
153 | */
|
154 | delete(params: OptionalDefaults<GetSpaceMembershipProps>): Promise<any>;
|
155 | };
|