//native
type Box = {
token: string;
};
/**
* Update task assignment
* Updates a task assignment. This endpoint can be
used to update the state of a task assigned to a user.
*/
export async function main(
auth: Box,
task_assignment_id: string,
body: {
message?: string;
resolution_state?: "completed" | "incomplete" | "approved" | "rejected";
},
) {
const url = new URL(
`https://api.box.com/2.0/task_assignments/${task_assignment_id}`,
);
const response = await fetch(url, {
method: "PUT",
headers: {
"Content-Type": "application/json",
Authorization: "Bearer " + auth.token,
},
body: JSON.stringify(body),
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 235 days ago