//native
type Zoho = {
token: string;
};
/**
* Update global picklist
*
*/
export async function main(
auth: Zoho,
id: string,
body: {
global_picklists: {
display_label: string;
created_time: string;
modified_time: string;
id: string;
api_name: string;
actual_label: string;
description: string;
modified_by: { name: string; id: string; email?: string };
created_by: { name: string; id: string; email?: string };
presence: false | true;
pick_list_values_sorted_lexically: false | true;
pick_list_values: {
actual_value: string;
type: "unused" | "used";
id: string;
sequence_number: number;
display_value: string;
}[];
}[];
},
) {
const url = new URL(
`https://zohoapis.com/crm/v8/settings/global_picklists/${id}`,
);
const response = await fetch(url, {
method: "PATCH",
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