//native
type Clickup = {
token: string;
};
/**
* Merge Tasks
* Merge multiple tasks into a target task. The target task is specified by the task_id parameter, while the source tasks to be merged are provided in the request body. Custom Task IDs are not supported.
*/
export async function main(
auth: Clickup,
task_id: string,
body: { source_task_ids: string[] },
) {
const url = new URL(`https://api.clickup.com/api/v2/task/${task_id}/merge`);
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.text();
}
Submitted by hugo697 235 days ago