MCPcopy Create free account
hub / github.com/TraderAlice/OpenAlice / query

Function query

ui/src/api/events.ts:12–21  ·  view source on GitHub ↗
(opts: { page?: number; pageSize?: number; type?: string } = {})

Source from the content-addressed store, hash-verified

10
11export const eventsApi = {
12 async query(opts: { page?: number; pageSize?: number; type?: string } = {}): Promise<EventQueryResult> {
13 const params = new URLSearchParams()
14 if (opts.page) params.set('page', String(opts.page))
15 if (opts.pageSize) params.set('pageSize', String(opts.pageSize))
16 if (opts.type) params.set('type', opts.type)
17 const qs = params.toString()
18 const res = await fetch(`/api/events${qs ? `?${qs}` : ''}`)
19 if (!res.ok) throw new Error('Failed to query events')
20 return res.json()
21 },
22
23 async recent(opts: { afterSeq?: number; limit?: number; type?: string } = {}): Promise<{ entries: EventLogEntry[]; lastSeq: number }> {
24 const params = new URLSearchParams()

Callers

nothing calls this directly

Calls 3

setMethod · 0.65
fetchFunction · 0.50
toStringMethod · 0.45

Tested by

no test coverage detected