//native
type Clickup = {
token: string;
};
/**
* Update Space
* Rename, set the Space color, and enable ClickApps for a Space.
*/
export async function main(
auth: Clickup,
space_id: string,
body: {
name: string;
color: string;
private: false | true;
admin_can_manage: false | true;
multiple_assignees: false | true;
features: {
due_dates: {
enabled: false | true;
start_date: false | true;
remap_due_dates: false | true;
remap_closed_due_date: false | true;
};
time_tracking: { enabled: false | true };
tags: { enabled: false | true };
time_estimates: { enabled: false | true };
checklists: { enabled: false | true };
custom_fields: { enabled: false | true };
remap_dependencies: { enabled: false | true };
dependency_warning: { enabled: false | true };
portfolios: { enabled: false | true };
};
},
) {
const url = new URL(`https://api.clickup.com/api/v2/space/${space_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 168 days ago