@doist/comms-sdk 0.2.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -12,9 +12,13 @@ class WorkspaceUsersClient extends base_client_1.BaseClient {
|
|
|
12
12
|
/**
|
|
13
13
|
* Returns a list of workspace user objects for the given workspace id.
|
|
14
14
|
*
|
|
15
|
+
* Removed users are excluded by default; set `args.includeRemoved` to `true` to include them.
|
|
16
|
+
* The Comms API always returns removed users, so the filtering happens client-side.
|
|
17
|
+
*
|
|
15
18
|
* @param args - The arguments for getting workspace users.
|
|
16
19
|
* @param args.workspaceId - The workspace ID.
|
|
17
20
|
* @param args.archived - Optional flag to filter archived users.
|
|
21
|
+
* @param args.includeRemoved - Include users removed from the workspace. Defaults to `false`.
|
|
18
22
|
* @returns An array of workspace user objects.
|
|
19
23
|
*
|
|
20
24
|
* @example
|
|
@@ -24,6 +28,7 @@ class WorkspaceUsersClient extends base_client_1.BaseClient {
|
|
|
24
28
|
* ```
|
|
25
29
|
*/
|
|
26
30
|
getWorkspaceUsers(args) {
|
|
31
|
+
const includeRemoved = args.includeRemoved ?? false;
|
|
27
32
|
return (0, http_client_1.request)({
|
|
28
33
|
httpMethod: 'GET',
|
|
29
34
|
baseUri: this.getBaseUri(),
|
|
@@ -31,7 +36,12 @@ class WorkspaceUsersClient extends base_client_1.BaseClient {
|
|
|
31
36
|
apiToken: this.apiToken,
|
|
32
37
|
payload: { id: args.workspaceId, archived: args.archived },
|
|
33
38
|
customFetch: this.customFetch,
|
|
34
|
-
}).then((response) =>
|
|
39
|
+
}).then((response) => {
|
|
40
|
+
const rawUsers = includeRemoved
|
|
41
|
+
? response.data
|
|
42
|
+
: response.data.filter((user) => !user.removed);
|
|
43
|
+
return rawUsers.map((user) => entities_1.WorkspaceUserSchema.parse(user));
|
|
44
|
+
});
|
|
35
45
|
}
|
|
36
46
|
/**
|
|
37
47
|
* Returns a list of workspace user IDs for the given workspace id.
|
|
@@ -9,9 +9,13 @@ export class WorkspaceUsersClient extends BaseClient {
|
|
|
9
9
|
/**
|
|
10
10
|
* Returns a list of workspace user objects for the given workspace id.
|
|
11
11
|
*
|
|
12
|
+
* Removed users are excluded by default; set `args.includeRemoved` to `true` to include them.
|
|
13
|
+
* The Comms API always returns removed users, so the filtering happens client-side.
|
|
14
|
+
*
|
|
12
15
|
* @param args - The arguments for getting workspace users.
|
|
13
16
|
* @param args.workspaceId - The workspace ID.
|
|
14
17
|
* @param args.archived - Optional flag to filter archived users.
|
|
18
|
+
* @param args.includeRemoved - Include users removed from the workspace. Defaults to `false`.
|
|
15
19
|
* @returns An array of workspace user objects.
|
|
16
20
|
*
|
|
17
21
|
* @example
|
|
@@ -21,6 +25,7 @@ export class WorkspaceUsersClient extends BaseClient {
|
|
|
21
25
|
* ```
|
|
22
26
|
*/
|
|
23
27
|
getWorkspaceUsers(args) {
|
|
28
|
+
const includeRemoved = args.includeRemoved ?? false;
|
|
24
29
|
return request({
|
|
25
30
|
httpMethod: 'GET',
|
|
26
31
|
baseUri: this.getBaseUri(),
|
|
@@ -28,7 +33,12 @@ export class WorkspaceUsersClient extends BaseClient {
|
|
|
28
33
|
apiToken: this.apiToken,
|
|
29
34
|
payload: { id: args.workspaceId, archived: args.archived },
|
|
30
35
|
customFetch: this.customFetch,
|
|
31
|
-
}).then((response) =>
|
|
36
|
+
}).then((response) => {
|
|
37
|
+
const rawUsers = includeRemoved
|
|
38
|
+
? response.data
|
|
39
|
+
: response.data.filter((user) => !user.removed);
|
|
40
|
+
return rawUsers.map((user) => WorkspaceUserSchema.parse(user));
|
|
41
|
+
});
|
|
32
42
|
}
|
|
33
43
|
/**
|
|
34
44
|
* Returns a list of workspace user IDs for the given workspace id.
|
|
@@ -10,9 +10,13 @@ export declare class WorkspaceUsersClient extends BaseClient {
|
|
|
10
10
|
/**
|
|
11
11
|
* Returns a list of workspace user objects for the given workspace id.
|
|
12
12
|
*
|
|
13
|
+
* Removed users are excluded by default; set `args.includeRemoved` to `true` to include them.
|
|
14
|
+
* The Comms API always returns removed users, so the filtering happens client-side.
|
|
15
|
+
*
|
|
13
16
|
* @param args - The arguments for getting workspace users.
|
|
14
17
|
* @param args.workspaceId - The workspace ID.
|
|
15
18
|
* @param args.archived - Optional flag to filter archived users.
|
|
19
|
+
* @param args.includeRemoved - Include users removed from the workspace. Defaults to `false`.
|
|
16
20
|
* @returns An array of workspace user objects.
|
|
17
21
|
*
|
|
18
22
|
* @example
|
|
@@ -346,6 +346,11 @@ export type RemoveGroupUsersArgs = {
|
|
|
346
346
|
export type GetWorkspaceUsersArgs = {
|
|
347
347
|
workspaceId: number;
|
|
348
348
|
archived?: boolean;
|
|
349
|
+
/**
|
|
350
|
+
* Include users who have been removed from the workspace. Defaults to `false`.
|
|
351
|
+
* The Comms API always returns removed users, so the SDK filters them client-side.
|
|
352
|
+
*/
|
|
353
|
+
includeRemoved?: boolean;
|
|
349
354
|
};
|
|
350
355
|
export type GetUserByIdArgs = {
|
|
351
356
|
workspaceId: number;
|