//native
type Zoho = {
token: string;
};
/**
* Get unassigned groups
*
*/
export async function main(
auth: Zoho,
body: {
get_unassigned: {
feature: "user_groups";
related_entity_id: string;
page?: number;
per_page?: number;
id?: string;
filters?: {
comparator: string;
field: { api_name: string; id: string };
group_operator: "OR" | "AND";
group: {}[];
value: {};
};
};
},
) {
const url = new URL(
`https://zohoapis.com/crm/v8/settings/user_groups/actions/get_unassigned`,
);
const response = await fetch(url, {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: "Zoho-oauthtoken " + 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