export type PatchApiScheduledReportsIdArgs = {id: number, body: {scheduled_report: {name?: string | undefined, enabled?: boolean | undefined, period?: ('day' | 'week' | 'month') | undefined, frequency?: number | undefined, scheduled_at?: string | undefined, emails?: Array | undefined, time_zone?: string | undefined}}}; export type PatchApiScheduledReportsIdOptions = {baseUrl?: string | undefined, KisiLogin?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update scheduled report * * PATCH /scheduled_reports/{id} * * Also accepts auth: OAuth2 */ export const patchApiScheduledReportsId = async (args: PatchApiScheduledReportsIdArgs, options?: PatchApiScheduledReportsIdOptions) => { const {baseUrl = "https://api.kisi.io", fetch: fetchFn = fetch, KisiLogin} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (KisiLogin !== undefined) headers.set("Authorization", KisiLogin) const url = `${baseUrl.replace(/\/+$/, '')}/scheduled_reports/${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 };