0
List Users
One script reply has been approved by the moderators Verified
Created by adam186 360 days ago Viewed 4224 times
0
Submitted by adam186 Deno
Verified 360 days ago
1
import { removeObjectEmptyFields } from "https://deno.land/x/windmill_helpers@v1.1.1/mod.ts";
2
import { Client } from "npm:@notionhq/client";
3

4
/**
5
 * @param start_cursor If supplied, only results starting after the cursor will be returned.
6
 *
7
 * @param page_size The number of items in the response. Maximum is `100`.
8
 *
9
 * Learn more at
10
 * https://developers.notion.com/reference/get-users
11
 */
12
type Notion = {
13
  token: string;
14
};
15
export async function main(
16
  auth: Notion,
17
  start_cursor?: string | undefined,
18
  page_size?: number | undefined,
19
) {
20
  const client = new Client({ auth: auth.token });
21
  const args = removeObjectEmptyFields({
22
    page_size,
23
    start_cursor,
24
  });
25
  return await client.users.list(args);
26
}
27