export type CreateApiSeltzV1SearchArgs = {body: {query: string, max_results?: number | undefined, scope?: string | undefined, include_domains?: Array | undefined, exclude_domains?: Array | undefined, from_date?: string | undefined, to_date?: string | undefined}}; export type CreateApiSeltzV1SearchOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Search the web and return matching documents with URLs and content. * * POST /seltz/v1/search */ export const createApiSeltzV1Search = async (args: CreateApiSeltzV1SearchArgs, options?: CreateApiSeltzV1SearchOptions) => { const {baseUrl = "https://api.orthogonal.com/mpp", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/seltz/v1/search${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", 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 };