export type GetApiFindymailApiIntellimatchStatusArgs = {hash: string}; export type GetApiFindymailApiIntellimatchStatusOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Poll export status for an Intellimatch search. Returns success, processing, pending, failed, or not_found. * * GET /findymail/api/intellimatch/status */ export const getApiFindymailApiIntellimatchStatus = async (args: GetApiFindymailApiIntellimatchStatusArgs, options?: GetApiFindymailApiIntellimatchStatusOptions) => { const {baseUrl = "https://api.orthogonal.com/mpp", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.hash != null) query.append("hash", String(args.hash)) const url = `${baseUrl.replace(/\/+$/, '')}/findymail/api/intellimatch/status${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 undefined };