export type GetApiPoslinkV3PaymentRequestsPaymentRequestIdArgs = {'payment-request-id': string}; export type GetApiPoslinkV3PaymentRequestsPaymentRequestIdOptions = {baseUrl?: string | undefined, authorisation?: string | undefined, fetch?: typeof fetch | undefined}; /** * Follow a payment or refund live * * GET /poslink/v3/payment-requests/{payment-request-id} */ export const getApiPoslinkV3PaymentRequestsPaymentRequestId = async (args: GetApiPoslinkV3PaymentRequestsPaymentRequestIdArgs, options?: GetApiPoslinkV3PaymentRequestsPaymentRequestIdOptions) => { const {baseUrl = "https://api.teya.com", fetch: fetchFn = fetch, authorisation} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "text/event-stream") if (authorisation !== undefined) headers.set('authorization', `Bearer ${authorisation}`) const url = `${baseUrl.replace(/\/+$/, '')}/poslink/v3/payment-requests/${encodeURIComponent(String(args['payment-request-id']))}${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.text() };