//native
type Zoho = {
token: string;
};
/**
* Get deleted records
*
*/
export async function main(
auth: Zoho,
module_api_name: string,
_type: string | undefined,
page: string | undefined,
per_page: string | undefined,
If_Modified_Since?: string,
) {
const url = new URL(`https://zohoapis.com/crm/v8/${module_api_name}/deleted`);
for (const [k, v] of [
["type", _type],
["page", page],
["per_page", per_page],
]) {
if (v !== undefined && v !== "" && k !== undefined) {
url.searchParams.append(k, v);
}
}
const response = await fetch(url, {
method: "GET",
headers: {
...(If_Modified_Since ? { "If-Modified-Since": If_Modified_Since } : {}),
Authorization: "Zoho-oauthtoken " + auth.token,
},
body: undefined,
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 235 days ago