export type CreateApiV1ConsentConsentTokenApproveArgs = {consentToken: string}; export type CreateApiV1ConsentConsentTokenApproveOptions = {baseUrl?: string | undefined, bearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Approve consent request * * POST /v1/consent/{consentToken}/approve */ export const createApiV1ConsentConsentTokenApprove = async (args: CreateApiV1ConsentConsentTokenApproveArgs, options?: CreateApiV1ConsentConsentTokenApproveOptions) => { 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))}/approve${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() };