export type CreateApiInquiriesArgs = {body: {type_id: number, branch_id?: number | undefined, manager_id?: number | undefined, asset_id?: number | undefined, client_id?: number | undefined, client_name?: string | undefined, client_phone?: string | undefined, email?: string | undefined, urgent?: boolean | undefined, due_date?: string | undefined, ad_campaign_id?: number | undefined, comment?: string | undefined, manager_notes?: string | undefined, address?: ({country: string, state?: string | undefined, city?: string | undefined, address_line_1: string, address_line_2?: string | undefined, postal_code?: string | undefined, comment?: string | undefined}) | undefined, custom_fields?: unknown | undefined}}; export type CreateApiInquiriesOptions = {baseUrl?: string | undefined, apiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Create Inquiry * * POST /inquiries */ export const createApiInquiries = async (args: CreateApiInquiriesArgs, options?: CreateApiInquiriesOptions) => { const {baseUrl = "https://api.roapp.io/v2", fetch: fetchFn = fetch, apiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (apiKey !== undefined) headers.set('authorization', `Bearer ${apiKey}`) const url = `${baseUrl.replace(/\/+$/, '')}/inquiries${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 };