Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions lib/api/live.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ import {
ResourceSchema,
AccessPolicySchema,
WebhookEventLogSchema,
WebhookEventSchema,
PaginatedSchema,
SiweAuthSessionSchema,
Connection,
ConnectionSchema,
Expand Down Expand Up @@ -926,6 +928,7 @@ export class LiveAccessApi implements AccessApi {

return await getJson<Paginated<WebhookEvent>>(`/v1/admin/events/paginated?${searchParams.toString()}`, {
headers: this.authHeaders(),
schema: PaginatedSchema(WebhookEventSchema),
})
}

Expand Down
17 changes: 17 additions & 0 deletions lib/api/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -484,13 +484,30 @@ export interface WebhookEvent {
status?: string
}

export const WebhookEventSchema = z.object({
id: z.string(),
type: z.string(),
payload: z.any(),
createdAt: z.string(),
status: z.string().optional(),
})

export interface Paginated<T> {
data: T[]
total: number
page: number
limit: number
}

export function PaginatedSchema<T extends z.ZodTypeAny>(itemSchema: T) {
return z.object({
data: z.array(itemSchema),
total: z.number(),
page: z.number(),
limit: z.number(),
})
}

export interface AdminEventFilterParams {
types?: string[]
startDate?: string
Expand Down