export type GetApiApiV1LedgersConnectionsConnectionIdBlocksArgs = {connectionId: number, top?: number | undefined, skip?: number | undefined}; export type GetApiApiV1LedgersConnectionsConnectionIdBlocksOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * GET /api/v1/ledgers/connections/{connectionId}/blocks */ export const getApiApiV1LedgersConnectionsConnectionIdBlocks = async (args: GetApiApiV1LedgersConnectionsConnectionIdBlocksArgs, options: GetApiApiV1LedgersConnectionsConnectionIdBlocksOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "*/*") if (args.top != null) query.append("top", String(args.top)) if (args.skip != null) query.append("skip", String(args.skip)) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/ledgers/connections/${encodeURIComponent(String(args.connectionId))}/blocks${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() };