1 | |
2 | * list hub integrations |
3 | * |
4 | */ |
5 | export async function main(kind: string | undefined) { |
6 | const url = new URL(`${BASE_URL}/api/integrations/hub/list`); |
7 | for (const [k, v] of [["kind", kind]]) { |
8 | if (v !== undefined && v !== "") { |
9 | url.searchParams.append(k, v); |
10 | } |
11 | } |
12 | const response = await fetch(url, { |
13 | method: "GET", |
14 | headers: { |
15 | Authorization: "Bearer " + WM_TOKEN, |
16 | }, |
17 | body: undefined, |
18 | }); |
19 | if (!response.ok) { |
20 | const text = await response.text(); |
21 | throw new Error(`${response.status} ${text}`); |
22 | } |
23 | return await response.json(); |
24 | } |
25 |
|