1 | |
2 | type Box = { |
3 | token: string; |
4 | }; |
5 | |
6 | * List Slack integration mappings |
7 | * Lists [Slack integration mappings](https://support.box.com/hc/en-us/articles/4415585987859-Box-as-the-Content-Layer-for-Slack) in a users' enterprise. |
8 |
|
9 | You need Admin or Co-Admin role to |
10 | use this endpoint. |
11 | */ |
12 | export async function main( |
13 | auth: Box, |
14 | marker: string | undefined, |
15 | limit: string | undefined, |
16 | partner_item_type: "channel" | undefined, |
17 | partner_item_id: string | undefined, |
18 | box_item_id: string | undefined, |
19 | box_item_type: "folder" | undefined, |
20 | is_manually_created: string | undefined, |
21 | ) { |
22 | const url = new URL(`https://api.box.com/2.0/integration_mappings/slack`); |
23 | for (const [k, v] of [ |
24 | ["marker", marker], |
25 | ["limit", limit], |
26 | ["partner_item_type", partner_item_type], |
27 | ["partner_item_id", partner_item_id], |
28 | ["box_item_id", box_item_id], |
29 | ["box_item_type", box_item_type], |
30 | ["is_manually_created", is_manually_created], |
31 | ]) { |
32 | if (v !== undefined && v !== "" && k !== undefined) { |
33 | url.searchParams.append(k, v); |
34 | } |
35 | } |
36 | const response = await fetch(url, { |
37 | method: "GET", |
38 | headers: { |
39 | Authorization: "Bearer " + auth.token, |
40 | }, |
41 | body: undefined, |
42 | }); |
43 | if (!response.ok) { |
44 | const text = await response.text(); |
45 | throw new Error(`${response.status} ${text}`); |
46 | } |
47 | return await response.json(); |
48 | } |
49 |
|