export type CreateApiAppsGovEsV1EntrySiloEntryIdSystemIdentityArgs = {silo_entry_id: string, system: 'sii', body: {data: string, view: 'front' | 'back' | 'page'}}; export type CreateApiAppsGovEsV1EntrySiloEntryIdSystemIdentityOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Upload an image of an identity document. * * POST /apps/gov-es/v1/entry/{silo_entry_id}/{system}/identity */ export const createApiAppsGovEsV1EntrySiloEntryIdSystemIdentity = async (args: CreateApiAppsGovEsV1EntrySiloEntryIdSystemIdentityArgs, options?: CreateApiAppsGovEsV1EntrySiloEntryIdSystemIdentityOptions) => { const {baseUrl = "https://api.invopop.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/apps/gov-es/v1/entry/${encodeURIComponent(String(args.silo_entry_id))}/${encodeURIComponent(String(args.system))}/identity${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 };