//native
type Clickup = {
token: string;
};
/**
* Edit User On Workspace
* Update a user's name and role. \
\
***Note:** This endpoint is only available to Workspaces on our [Enterprise Plan](https://clickup.com/pricing).*
*/
export async function main(
auth: Clickup,
team_id: string,
user_id: string,
body: { username: string; admin: false | true; custom_role_id: number },
) {
const url = new URL(
`https://api.clickup.com/api/v2/team/${team_id}/user/${user_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