//native
type Clickup = {
token: string;
};
/**
* Edit Key Result
* Update a Target.
*/
export async function main(
auth: Clickup,
key_result_id: string,
body: { steps_current: number; note: string },
) {
const url = new URL(
`https://api.clickup.com/api/v2/key_result/${key_result_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