Spaces:
Runtime error
Runtime error
Download frontend/src/services/developerService.ts from Talosware/talos-access: direct link, hf CLI and curl.
- Browser
- Download file 2.81 kB
-
https://huggingface.co/spaces/Talosware/talos-access/resolve/main/frontend/src/services/developerService.ts
- Command line
-
hf download hf://spaces/Talosware/talos-access/frontend/src/services/developerService.ts
-
curl -L -o developerService.ts https://huggingface.co/spaces/Talosware/talos-access/resolve/main/frontend/src/services/developerService.ts
2.81 kB
| import api from './api'; | |
| export interface DeveloperDashboard { | |
| total_accounts: number; | |
| active_accounts: number; | |
| trial_accounts: number; | |
| total_users: number; | |
| accounts_by_date: { date: string; count: number }[]; | |
| errors_trend: { date: string; count: number }[]; | |
| accounts: DeveloperAccount[]; | |
| } | |
| export interface DeveloperAccount { | |
| id: number; | |
| name: string; | |
| is_active: boolean; | |
| trial_end_date: string | null; | |
| plan: string; | |
| user_count: number; | |
| } | |
| export interface SystemLogEntry { | |
| id: number; | |
| level: string; | |
| message: string; | |
| traceback: string | null; | |
| endpoint: string | null; | |
| method: string | null; | |
| account_id: number | null; | |
| user_id: number | null; | |
| ip_address: string | null; | |
| created_at: string; | |
| } | |
| export interface PaginatedLogs { | |
| items: SystemLogEntry[]; | |
| total: number; | |
| page: number; | |
| per_page: number; | |
| total_pages: number; | |
| } | |
| export async function getDeveloperDashboard(): Promise<DeveloperDashboard> { | |
| const { data } = await api.get('/developer/dashboard'); | |
| return data; | |
| } | |
| export async function listDeveloperAccounts(search?: string): Promise<DeveloperAccount[]> { | |
| const params = search ? { search } : {}; | |
| const { data } = await api.get('/developer/accounts', { params }); | |
| return data; | |
| } | |
| export async function toggleAccountActive(accountId: number): Promise<{ id: number; is_active: boolean }> { | |
| const { data } = await api.put(`/developer/accounts/${accountId}/toggle-active`); | |
| return data; | |
| } | |
| export async function setAccountTrial(accountId: number, days: number): Promise<{ id: number; trial_end_date: string }> { | |
| const { data } = await api.put(`/developer/accounts/${accountId}/trial`, null, { params: { days } }); | |
| return data; | |
| } | |
| export async function getSystemLogs(page = 1, perPage = 20, level?: string): Promise<PaginatedLogs> { | |
| const params: Record<string, any> = { page, per_page: perPage }; | |
| if (level) params.level = level; | |
| const { data } = await api.get('/developer/logs', { params }); | |
| return data; | |
| } | |
| export async function getLogsTrend(days = 30): Promise<{ date: string; count: number }[]> { | |
| const { data } = await api.get('/developer/logs/trend', { params: { days } }); | |
| return data; | |
| } | |
| export async function getUsersByAccount(): Promise<{ account_name: string; account_id: number; user_count: number }[]> { | |
| const { data } = await api.get('/developer/users-by-account'); | |
| return data; | |
| } | |
| export function getExportUrl(): string { | |
| return `${api.defaults.baseURL}/developer/export`; | |
| } | |
| export interface PurgeDemoResponse { | |
| success: boolean; | |
| demo_account_id: number; | |
| deleted: Record<string, number>; | |
| reseeded: boolean; | |
| } | |
| export async function purgeDemoData(password: string): Promise<PurgeDemoResponse> { | |
| const { data } = await api.post('/developer/purge-demo', { password }); | |
| return data; | |
| } | |