| 20 | } |
| 21 | |
| 22 | export interface IApiClient { |
| 23 | /** |
| 24 | * Make an authenticated HTTP request |
| 25 | * @param endpoint - API endpoint path (relative to base URL) |
| 26 | * @param options - Request options |
| 27 | * @returns Typed response |
| 28 | */ |
| 29 | request<TResponse>(endpoint: string, options?: ApiRequestOptions): Promise<ApiResponse<TResponse>> |
| 30 | |
| 31 | /** |
| 32 | * GET request helper |
| 33 | */ |
| 34 | get<TResponse>(endpoint: string, options?: Omit<ApiRequestOptions, 'method'>): Promise<ApiResponse<TResponse>> |
| 35 | |
| 36 | /** |
| 37 | * POST request helper |
| 38 | */ |
| 39 | post<TResponse>(endpoint: string, body?: unknown, options?: Omit<ApiRequestOptions, 'method' | 'body'>): Promise<ApiResponse<TResponse>> |
| 40 | |
| 41 | /** |
| 42 | * PUT request helper |
| 43 | */ |
| 44 | put<TResponse>(endpoint: string, body?: unknown, options?: Omit<ApiRequestOptions, 'method' | 'body'>): Promise<ApiResponse<TResponse>> |
| 45 | |
| 46 | /** |
| 47 | * DELETE request helper |
| 48 | */ |
| 49 | delete<TResponse>(endpoint: string, options?: Omit<ApiRequestOptions, 'method'>): Promise<ApiResponse<TResponse>> |
| 50 | |
| 51 | /** |
| 52 | * Set the authentication token |
| 53 | */ |
| 54 | setToken(token: string | null): void |
| 55 | |
| 56 | /** |
| 57 | * Get current token |
| 58 | */ |
| 59 | getToken(): string | null |
| 60 | |
| 61 | /** |
| 62 | * Set token refresh callback |
| 63 | */ |
| 64 | setTokenRefreshCallback(callback: () => Promise<string | null>): void |
| 65 | } |
| 66 | |
| 67 | /** |
| 68 | * Base API client implementation |
no outgoing calls
no test coverage detected