export type GetApiV0PaymentsIdArgs = {id: string}; export type GetApiV0PaymentsIdOptions = {baseUrl: string, apikeyAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get Payment * * GET /v0/payments/{id} */ export const getApiV0PaymentsId = async (args: GetApiV0PaymentsIdArgs, options: GetApiV0PaymentsIdOptions) => { const {baseUrl, fetch: fetchFn = fetch, apikeyAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/json") if (apikeyAuth !== undefined) headers.set("apikey", apikeyAuth) const url = `${baseUrl.replace(/\/+$/, '')}/v0/payments/${encodeURIComponent(String(args.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 (await res.json()) as unknown };