//native
type Box = {
token: string;
};
/**
* Get zip download status
* Returns the download status of a `zip` archive, allowing an application to
inspect the progress of the download as well as the number of items that
might have been skipped.
*/
export async function main(auth: Box, zip_download_id: string) {
const url = new URL(
`https://api.box.com/2.0/zip_downloads/${zip_download_id}/status`,
);
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