Skip to content

Commit 2f73b21

Browse files
committed
feat: add JSDoc for workspace client
Signed-off-by: SuZhou-Joe <[email protected]>
1 parent d0d5882 commit 2f73b21

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

src/plugins/workspace/server/types.ts

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,38 @@ export interface IRequestDetail {
2929
}
3030

3131
export interface IWorkspaceClientImpl {
32+
/**
33+
* Setup function for workspace client, need to be called before any other methods.
34+
* @param dep {@link CoreSetup}
35+
* @returns a promise indicate if the setup has successed.
36+
* @public
37+
*/
3238
setup(dep: CoreSetup): Promise<IResponse<boolean>>;
39+
/**
40+
* Set saved objects client that will be used inside the workspace client.
41+
* @param savedObjects {@link SavedObjectsServiceStart}
42+
* @returns void
43+
* @public
44+
*/
3345
setSavedObjects(savedObjects: SavedObjectsServiceStart): void;
46+
/**
47+
* Create a workspace
48+
* @param requestDetail {@link IRequestDetail}
49+
* @param payload {@link WorkspaceAttribute}
50+
* @returns a Promise with a new-created id for the workspace
51+
* @public
52+
*/
3453
create(
3554
requestDetail: IRequestDetail,
3655
payload: Omit<WorkspaceAttribute, 'id'>
3756
): Promise<IResponse<{ id: WorkspaceAttribute['id'] }>>;
57+
/**
58+
* List workspaces
59+
* @param requestDetail {@link IRequestDetail}
60+
* @param options {@link WorkspaceFindOptions}
61+
* @returns a Promise with workspaces list
62+
* @public
63+
*/
3864
list(
3965
requestDetail: IRequestDetail,
4066
options: WorkspaceFindOptions
@@ -45,13 +71,40 @@ export interface IWorkspaceClientImpl {
4571
} & Pick<SavedObjectsFindResponse, 'page' | 'per_page' | 'total'>
4672
>
4773
>;
74+
/**
75+
* Get the detail of a given workspace id
76+
* @param requestDetail {@link IRequestDetail}
77+
* @param id workspace id
78+
* @returns a Promise with the detail of {@link WorkspaceAttribute}
79+
* @public
80+
*/
4881
get(requestDetail: IRequestDetail, id: string): Promise<IResponse<WorkspaceAttribute>>;
82+
/**
83+
* Update the detail of a given workspace
84+
* @param requestDetail {@link IRequestDetail}
85+
* @param id workspace id
86+
* @param payload {@link WorkspaceAttribute}
87+
* @returns a Promise with a boolean result indicating if the update operation successed.
88+
* @public
89+
*/
4990
update(
5091
requestDetail: IRequestDetail,
5192
id: string,
5293
payload: Omit<WorkspaceAttribute, 'id'>
5394
): Promise<IResponse<boolean>>;
95+
/**
96+
* Delete a given workspace
97+
* @param requestDetail {@link IRequestDetail}
98+
* @param id workspace id
99+
* @returns a Promise with a boolean result indicating if the delete operation successed.
100+
* @public
101+
*/
54102
delete(requestDetail: IRequestDetail, id: string): Promise<IResponse<boolean>>;
103+
/**
104+
* Destroy the workspace client, should be called after the server disposes.
105+
* @returns a Promise with a boolean result indicating if the destroy operation successed.
106+
* @public
107+
*/
55108
destroy(): Promise<IResponse<boolean>>;
56109
}
57110

0 commit comments

Comments
 (0)