export type CreateApiV1FederationVerifyChallengeTokenArgs = {challengeToken: string}; export type CreateApiV1FederationVerifyChallengeTokenOptions = {baseUrl?: string | undefined, bearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Verify federation link * * POST /v1/federation/verify/{challengeToken} */ export const createApiV1FederationVerifyChallengeToken = async (args: CreateApiV1FederationVerifyChallengeTokenArgs, options?: CreateApiV1FederationVerifyChallengeTokenOptions) => { 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/federation/verify/${encodeURIComponent(String(args.challengeToken))}${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 res.blob() };