0
List Users
One script reply has been approved by the moderators Verified
Created by rosseastdene 930 days ago Viewed 10110 times
0
Submitted by adam186 Deno
Verified 677 days ago
1
import { removeObjectEmptyFields } from "https://deno.land/x/windmill_helpers@v1.0.1/mod.ts";
2
import { SlackAPI } from "https://deno.land/x/deno_slack_api@1.6.0/mod.ts";
3

4
/**
5
 * @param cursor Paginate the list of users by setting the cursor parameter
6
 * to a `next_cursor` attribute returned by a previous request's
7
 * `response_metadata`. Default value fetches the first "page" of the users.
8
 * Used in conjunction with `limit`.
9
 *
10
 * @param limit The maximum number of users to return. Fewer than the
11
 * requested number of users may be returned, even if the end of the result
12
 * list hasn't been reached.
13
 * Used in conjunction with `cursor`.
14
 */
15
type Slack = {
16
  token: string;
17
};
18
export async function main(auth: Slack, cursor?: string, limit?: number) {
19
  const client = SlackAPI(auth.token);
20
  const params = removeObjectEmptyFields({ cursor, limit });
21
  return await client.users.list(params);
22
}
23

Other submissions