import api from './api'; export interface ErrorEvent { id: number; origin: string; language?: string; severity?: string; message: string; stack?: string; component?: string; file?: string; line?: number; column?: number; url?: string; method?: string; status?: number; request_id?: string; user_id?: number; session_token?: string; tags?: Record | null; context?: Record | null; env?: string; version?: string; hostname?: string; occurred_at: string; created_at: string; } export interface ErrorListResponse { items: ErrorEvent[]; total: number; } export async function getErrors(params?: { origin?: string; severity?: string; method?: string; status?: string | number; search?: string; from?: string; // ISO to?: string; // ISO page?: number; limit?: number; }): Promise { const res = await api.get('/admin/errors', { params }); return res.data as ErrorListResponse; } export async function getError(id: number): Promise { const res = await api.get(`/admin/errors/${id}`); return res.data as ErrorEvent; } export async function getExternalErrors(params?: { origin?: string; severity?: string; method?: string; status?: string | number; search?: string; from?: string; // ISO to?: string; // ISO page?: number; limit?: number; }): Promise { const res = await api.get('/admin/errors/external', { params }); return res.data as ErrorListResponse; } export async function getExternalError(id: number): Promise { const res = await api.get(`/admin/errors/external/${id}`); return res.data as ErrorEvent; }