export type GetApiV1ConsentConsentTokenArgs = {consentToken: string}; export type GetApiV1ConsentConsentTokenOptions = {baseUrl?: string | undefined, bearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get consent details * * GET /v1/consent/{consentToken} */ export const getApiV1ConsentConsentToken = async (args: GetApiV1ConsentConsentTokenArgs, options?: GetApiV1ConsentConsentTokenOptions) => { const {baseUrl = "https://idaas.yourflexpay.com/api", fetch: fetchFn = fetch, bearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "*/*") if (bearerAuth !== undefined) headers.set('authorization', `Bearer ${bearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/consent/${encodeURIComponent(String(args.consentToken))}${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 res.blob() };