//native
type Clickup = {
token: string;
};
/**
* Edit Checklist
* Rename a task checklist, or reorder a checklist so it appears above or below other checklists on a task.
*/
export async function main(
auth: Clickup,
checklist_id: string,
body: { name?: string; position?: number },
) {
const url = new URL(
`https://api.clickup.com/api/v2/checklist/${checklist_id}`,
);
const response = await fetch(url, {
method: "PUT",
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