export type GetApiReportPersonalReadingInstantArgs = {input: {first_name: string, middle_name?: string | undefined, last_name?: string | undefined, gender: 'male' | 'female', datetime: string, coordinates: string, place: string}, options: {modules: Array<{name: string, options: Record}>, template: {style: string, footer: string}, report: {name: string, caption: string, brand_name: string, la?: string | undefined}}}; export type GetApiReportPersonalReadingInstantOptions = {baseUrl?: string | undefined, oauth2?: string | undefined, fetch?: typeof fetch | undefined}; /** * Personal Reading Report PDF * * GET /report/personal-reading/instant */ export const getApiReportPersonalReadingInstant = async (args: GetApiReportPersonalReadingInstantArgs, options?: GetApiReportPersonalReadingInstantOptions) => { const {baseUrl = "https://api.prokerala.com/v2", fetch: fetchFn = fetch, oauth2} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/pdf") if (args.input != null) query.append("input", JSON.stringify(args.input)) if (args.options != null) query.append("options", JSON.stringify(args.options)) if (oauth2 !== undefined) headers.set('authorization', `Bearer ${oauth2}`) const url = `${baseUrl.replace(/\/+$/, '')}/report/personal-reading/instant${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return res.blob() };