//native
type Zoho = {
token: string;
};
/**
* Single update
*
*/
export async function main(
auth: Zoho,
_module: string,
id: string,
body: {
owner?: { id?: string };
notify?: false | true;
related_modules?: { id?: string; api_name?: string }[];
},
) {
const url = new URL(
`https://zohoapis.com/crm/v8/${_module}/${id}/actions/change_owner`,
);
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