//native
type Clickup = {
token: string;
};
/**
* Create Checklist Item
* Add a line item to a task checklist.
*/
export async function main(
auth: Clickup,
checklist_id: string,
body: { name?: string; assignee?: number },
) {
const url = new URL(
`https://api.clickup.com/api/v2/checklist/${checklist_id}/checklist_item`,
);
const response = await fetch(url, {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: 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