export type GetApiV1TransactionsReferenceWebhooksArgs = {reference: string}; export type GetApiV1TransactionsReferenceWebhooksOptions = {baseUrl?: string | undefined, bearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * List all webhook records for a transaction * * GET /v1/transactions/{reference}/webhooks */ export const getApiV1TransactionsReferenceWebhooks = async (args: GetApiV1TransactionsReferenceWebhooksArgs, options?: GetApiV1TransactionsReferenceWebhooksOptions) => { 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/transactions/${encodeURIComponent(String(args.reference))}/webhooks${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() };