UNPKG

2.7 kBTypeScriptView Raw
1import type { CollectionProp, GetOrganizationParams, GetSpaceParams, QueryParams } from '../../common-types';
2import type { UserProps } from '../../export-types';
3import type { OptionalDefaults } from '../wrappers/wrap';
4export type UserPlainClientAPI = {
5 /** Fetches all users in a space
6 *
7 * @param params space ID and query parameters
8 * @returns a collection of users
9 * @throws if the request fails or the users are not found
10 * @example
11 * ```javascript
12 * const users = await client.user.getManyForSpace({
13 * spaceId: '<space_id>',
14 * query: {
15 * limit: 100,
16 * },
17 * });
18 * ```
19 */
20 getManyForSpace(params: OptionalDefaults<GetSpaceParams & QueryParams>): Promise<CollectionProp<UserProps>>;
21 /**
22 * Fetches a user in a space
23 * @param params space ID, user ID, and query parameters
24 * @returns the user
25 * @throws if the request fails or the user is not found
26 * @example
27 * ```javascript
28 * const user = await client.user.getForSpace({
29 * spaceId: '<space_id>',
30 * userId: '<user_id>',
31 * });
32 * ```
33 */
34 getForSpace(params: OptionalDefaults<GetSpaceParams & {
35 userId: string;
36 }>): Promise<UserProps>;
37 /**
38 * Fetches the current user
39 * @param params query parameters
40 * @returns the current user
41 * @throws if the request fails or the user is not found
42 * @example
43 * ```javascript
44 * const user = await client.user.getCurrent();
45 * ```
46 */
47 getCurrent<T = UserProps>(params?: QueryParams): Promise<T>;
48 /**
49 * Fetches a user in an organization
50 * @param params organization ID, user ID, and query parameters
51 * @returns the user
52 * @throws if the request fails or the user is not found
53 * @example
54 * ```javascript
55 * const user = await client.user.getForOrganization({
56 * organizationId: '<organization_id>',
57 * userId: '<user_id>',
58 * });
59 * ```
60 */
61 getForOrganization(params: OptionalDefaults<GetOrganizationParams & {
62 userId: string;
63 }>): Promise<UserProps>;
64 /**
65 * Fetches all users in an organization
66 * @param params organization ID and query parameters
67 * @returns a collection of users
68 * @throws if the request fails or the users are not found
69 * @example
70 * ```javascript
71 * const users = await client.user.getManyForOrganization({
72 * organizationId: '<organization_id>',
73 * query: {
74 * limit: 100,
75 * },
76 * });
77 * ```
78 */
79 getManyForOrganization(params: OptionalDefaults<GetOrganizationParams & QueryParams>): Promise<CollectionProp<UserProps>>;
80};