//native
type Clickup = {
token: string;
};
/**
* Update privacy and access of an object or location
* Update the privacy and access settings of an object or location in the Workspace. Note that sharing an item may incur charges.
*/
export async function main(
auth: Clickup,
workspace_id: string,
object_type: string,
object_id: string,
body: {
entries?: { id?: string; kind?: string; permission_level?: number }[];
private?: false | true;
},
) {
const url = new URL(
`https://api.clickup.com/api/v3/workspaces/${workspace_id}/${object_type}/${object_id}/acls`,
);
const response = await fetch(url, {
method: "PATCH",
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