export type CreateApiUsersFundStepsArgs = {APIKey?: string | undefined, authorization_id?: string | undefined, 'Bui-Accept'?: string | undefined}; export type CreateApiUsersFundStepsOptions = {baseUrl: string, Bearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * Return fund authorization BUI form * * POST /users/fund-steps * * Also accepts auth: API-Key */ export const createApiUsersFundSteps = async (args: CreateApiUsersFundStepsArgs, options: CreateApiUsersFundStepsOptions) => { const {baseUrl, fetch: fetchFn = fetch, Bearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.APIKey != null) query.append("APIKey", String(args.APIKey)) if (args.authorization_id != null) query.append("authorization_id", String(args.authorization_id)) if (args['Bui-Accept'] != null) query.append("Bui-Accept", String(args['Bui-Accept'])) if (Bearer !== undefined) headers.set("Authorization", Bearer) const url = `${baseUrl.replace(/\/+$/, '')}/users/fund-steps${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };