export type Biometric = {index?: number | undefined, content?: string | undefined, width?: number | undefined, height?: number | undefined, resolution?: number | undefined}; export type MissingBiometric = {index?: number | undefined, type?: ('AMPUTATED' | 'UNAVAILABLE') | undefined, reason?: string | undefined}; export type UserTransaction = {biometrics?: Array | undefined, missingBiometrics?: Array | undefined, userId?: string | undefined, operatorId?: string | undefined, timestamp?: number | undefined}; export type UserTransactionRequest = {data?: UserTransaction | undefined}; export type CreateApiGbsSpidServerPeopleArgs = {body: UserTransactionRequest}; export type CreateApiGbsSpidServerPeopleOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * enroll * * POST /gbs-spid-server/people */ export const createApiGbsSpidServerPeople = async (args: CreateApiGbsSpidServerPeopleArgs, options?: CreateApiGbsSpidServerPeopleOptions) => { const {baseUrl = "http://:8085/gbds/v2", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "*/*") const url = `${baseUrl.replace(/\/+$/, '')}/gbs-spid-server/people${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 res.blob() };