1 | |
2 | * list all available apps |
3 | * |
4 | */ |
5 | export async function main( |
6 | workspace: string, |
7 | page: string | undefined, |
8 | per_page: string | undefined, |
9 | order_desc: string | undefined, |
10 | created_by: string | undefined, |
11 | path_start: string | undefined, |
12 | path_exact: string | undefined, |
13 | starred_only: string | undefined |
14 | ) { |
15 | const url = new URL(`${BASE_URL}/api/w/${workspace}/apps/list`); |
16 | for (const [k, v] of [ |
17 | ["page", page], |
18 | ["per_page", per_page], |
19 | ["order_desc", order_desc], |
20 | ["created_by", created_by], |
21 | ["path_start", path_start], |
22 | ["path_exact", path_exact], |
23 | ["starred_only", starred_only], |
24 | ]) { |
25 | if (v !== undefined) { |
26 | url.searchParams.append(k, v); |
27 | } |
28 | } |
29 | const response = await fetch(url, { |
30 | method: "GET", |
31 | headers: { |
32 | Authorization: "Bearer " + WM_TOKEN, |
33 | }, |
34 | body: undefined, |
35 | }); |
36 | return await response.json(); |
37 | } |
38 |
|