export type GetApiPoslinkV1ReceiptRequestsReceiptIdStatusArgs = {receipt_id: string}; export type GetApiPoslinkV1ReceiptRequestsReceiptIdStatusOptions = {baseUrl?: string | undefined, authorisation?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get receipt print job with real-time updates * * GET /poslink/v1/receipt-requests/{receipt_id}/status */ export const getApiPoslinkV1ReceiptRequestsReceiptIdStatus = async (args: GetApiPoslinkV1ReceiptRequestsReceiptIdStatusArgs, options?: GetApiPoslinkV1ReceiptRequestsReceiptIdStatusOptions) => { 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/v1/receipt-requests/${encodeURIComponent(String(args.receipt_id))}/status${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() };