//native
type Box = {
token: string;
};
/**
* List tasks on file
* Retrieves a list of all the tasks for a file. This
endpoint does not support pagination.
*/
export async function main(auth: Box, file_id: string) {
const url = new URL(`https://api.box.com/2.0/files/${file_id}/tasks`);
const response = await fetch(url, {
method: "GET",
headers: {
Authorization: "Bearer " + auth.token,
},
body: undefined,
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 235 days ago