//native
type Box = {
token: string;
};
/**
* Get upload session
* Return information about an upload session.
The actual endpoint URL is returned by the [`Create upload session`](e://post-files-upload-sessions) endpoint.
*/
export async function main(auth: Box, upload_session_id: string) {
const url = new URL(
`https://api.box.com/2.0/files/upload_sessions/${upload_session_id}`,
);
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