1 | import type { RawAxiosRequestHeaders } from 'axios';
|
2 | import type { GetSpaceParams, QueryParams, CollectionProp, GetOrganizationParams } from '../../common-types';
|
3 | import type { OptionalDefaults } from '../wrappers/wrap';
|
4 | import type { SpaceProps } from '../../entities/space';
|
5 | export type SpacePlainClientAPI = {
|
6 | /**
|
7 | * Fetches a space
|
8 | * @param params the space ID
|
9 | * @returns the space
|
10 | * @throws if the request fails, or the space is not found
|
11 | * @example ```javascript
|
12 | * const space = await client.space.get({
|
13 | * spaceId: '<space_id>',
|
14 | * });
|
15 | * ```
|
16 | */
|
17 | get(params: OptionalDefaults<GetSpaceParams>): Promise<SpaceProps>;
|
18 | /**
|
19 | * Fetches all the spaces that the logged in user has access to
|
20 | * @param params (optional) filter and pagination query parameters
|
21 | * @returns a collection of spaces
|
22 | * @throws if the request fails, or the query parameters are malformed
|
23 | * @example ```javascript
|
24 | * const space = await client.space.getMany({
|
25 | * query: {
|
26 | * limit: 10,
|
27 | * },
|
28 | * });
|
29 | * ```
|
30 | */
|
31 | getMany(params: OptionalDefaults<QueryParams>): Promise<CollectionProp<SpaceProps>>;
|
32 | /**
|
33 | * Fetches all the spaces in the given organization
|
34 | * @param params the organization ID and query parameters
|
35 | * @returns a collection of spaces
|
36 | * @throws if the request fails, the organization is not found, or the query parameters are malformed
|
37 | * @example ```javascript
|
38 | * const space = await client.space.getManyForOrganization({
|
39 | * organizationId: '<organization_id>',
|
40 | * query: {
|
41 | * limit: 10,
|
42 | * },
|
43 | * });
|
44 | * ```
|
45 | */
|
46 | getManyForOrganization(params: OptionalDefaults<GetOrganizationParams & QueryParams>): Promise<CollectionProp<SpaceProps>>;
|
47 | /**
|
48 | * Creates a space
|
49 | * @param params an organization ID
|
50 | * @param payload the space to create
|
51 | * @returns the created space
|
52 | * @throws if the request fails, or the payload is malformed
|
53 | * @example ```javascript
|
54 | * const space = await client.space.create(
|
55 | * {
|
56 | * organizationId: '<organization_id>',
|
57 | * },
|
58 | * {
|
59 | * name: 'New space',
|
60 | * }
|
61 | * );
|
62 | * ```
|
63 | */
|
64 | create(params: OptionalDefaults<{
|
65 | organizationId?: string;
|
66 | }>, payload: Omit<SpaceProps, 'sys'>, headers?: RawAxiosRequestHeaders): Promise<any>;
|
67 | /**
|
68 | * Updates a space
|
69 | * @param params the space ID
|
70 | * @param payload the space update
|
71 | * @returns the updated space
|
72 | * @throws if the request fails, the space is not found, or the payload is malformed
|
73 | * @example ```javascript
|
74 | * let space = await client.space.get({
|
75 | * spaceId: '<space_id>',
|
76 | * });
|
77 | *
|
78 | * space = await client.space.update(
|
79 | * {
|
80 | * spaceId: '<space_id>',
|
81 | * },
|
82 | * {
|
83 | * ...space.sys,
|
84 | * name: 'New name'
|
85 | * }
|
86 | * );
|
87 | * ```
|
88 | */
|
89 | update(params: OptionalDefaults<GetSpaceParams>, payload: SpaceProps, headers?: RawAxiosRequestHeaders): Promise<SpaceProps>;
|
90 | /**
|
91 | * Deletes a space
|
92 | * @param params the space ID
|
93 | * @returns void
|
94 | * @throws if the request fails, or the space is not found
|
95 | * @example ```javascript
|
96 | * await client.space.delete({
|
97 | * spaceId: '<space_id>',
|
98 | * });
|
99 | * ```
|
100 | */
|
101 | delete(params: OptionalDefaults<GetSpaceParams>): Promise<any>;
|
102 | };
|