//native
type Zoho = {
token: string;
};
/**
* Update fiscal year
*
*/
export async function main(
auth: Zoho,
body: {
fiscal_year: {
start_month:
| "June"
| "October"
| "December"
| "May"
| "September"
| "March"
| "July"
| "January"
| "February"
| "April"
| "August"
| "November";
display_based_on: "start_month" | "end_month";
id?: string;
};
},
) {
const url = new URL(`https://zohoapis.com/crm/v8/settings/fiscal_year`);
const response = await fetch(url, {
method: "PUT",
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