export type Id = number; export type Frequency = 'day' | 'week' | 'month' | 'year' | 'days' | 'weeks' | 'months' | 'years' | null; export type CustomFields = Record | null; export type PatchApiVehicleRenewalRemindersIdArgs = {id: string, body: {vehicle_id?: Id | undefined, vehicle_renewal_type_id?: Id | undefined, next_due_at?: string | undefined, due_soon_at?: string | undefined, due_soon_time_threshold_interval?: number | undefined, due_soon_time_threshold_frequency?: Frequency | undefined, active?: boolean | undefined, custom_fields?: CustomFields | undefined}}; export type PatchApiVehicleRenewalRemindersIdOptions = {baseUrl?: string | undefined, apiKey?: string | undefined, accountToken?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update Vehicle Renewal Reminder * * PATCH /vehicle_renewal_reminders/{id} */ export const patchApiVehicleRenewalRemindersId = async (args: PatchApiVehicleRenewalRemindersIdArgs, options?: PatchApiVehicleRenewalRemindersIdOptions) => { const {baseUrl = "https://secure.fleetio.com/api", fetch: fetchFn = fetch, apiKey, accountToken} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (apiKey !== undefined) headers.set("Authorization", apiKey) if (accountToken !== undefined) headers.set("Account-Token", accountToken) const url = `${baseUrl.replace(/\/+$/, '')}/vehicle_renewal_reminders/${encodeURIComponent(String(args.id))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PATCH", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };