export type AddCurpRequest = {curp?: string | undefined}; export type CreateApiOmniAddCurpArgs = {'api-version': string, body: AddCurpRequest}; export type CreateApiOmniAddCurpOptions = {baseUrl?: string | undefined, ApiKeyAuth?: string | undefined, IncodeHardwareIdAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Add curp * * POST /omni/add/curp */ export const createApiOmniAddCurp = async (args: CreateApiOmniAddCurpArgs, options?: CreateApiOmniAddCurpOptions) => { const {baseUrl = "https://demo-api.incodesmile.com", fetch: fetchFn = fetch, ApiKeyAuth, IncodeHardwareIdAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "application/json") if (args['api-version'] != null) headers.set("api-version", String(args['api-version'])) if (ApiKeyAuth !== undefined) headers.set("x-api-key", ApiKeyAuth) if (IncodeHardwareIdAuth !== undefined) headers.set("X-Incode-Hardware-Id", IncodeHardwareIdAuth) const url = `${baseUrl.replace(/\/+$/, '')}/omni/add/curp${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 (await res.json()) as unknown };