export type GetApiV1FinInstsFinInstRoleArgs = {finInstRole: 'psp' | 'fxp' | 'sap' | 'any'}; export type GetApiV1FinInstsFinInstRoleOptions = {baseUrl?: string | undefined, bearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get Financial Institutions by Role * * GET /v1/fin-insts/{finInstRole} */ export const getApiV1FinInstsFinInstRole = async (args: GetApiV1FinInstsFinInstRoleArgs, options?: GetApiV1FinInstsFinInstRoleOptions) => { const {baseUrl = "http://localhost:8080", fetch: fetchFn = fetch, bearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/json") if (bearerAuth !== undefined) headers.set('authorization', `Bearer ${bearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/fin-insts/${encodeURIComponent(String(args.finInstRole))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) 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 };