This is the initial commit for the CODEX_ADK project, a full-stack AI agent management platform featuring: BACKEND (ASP.NET Core 8.0): - CQRS architecture with 6 commands and 7 queries - 16 API endpoints (all working and tested) - PostgreSQL database with 5 entities - AES-256 encryption for API keys - FluentValidation on all commands - Rate limiting and CORS configured - OpenAPI/Swagger documentation - Docker Compose setup (PostgreSQL + Ollama) FRONTEND (Flutter 3.x): - Dark theme with Svrnty branding - Collapsible sidebar navigation - CQRS API client with Result<T> error handling - Type-safe endpoints from OpenAPI schema - Multi-platform support (Web, iOS, Android, macOS, Linux, Windows) DOCUMENTATION: - Comprehensive API reference - Architecture documentation - Development guidelines for Claude Code - API integration guides - context-claude.md project overview Status: Backend ready (Grade A-), Frontend integration pending 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
60 lines
1.7 KiB
Dart
60 lines
1.7 KiB
Dart
/// Health check endpoint for API connectivity testing
|
|
library;
|
|
|
|
import '../client.dart';
|
|
import '../types.dart';
|
|
|
|
// =============================================================================
|
|
// Health Endpoint
|
|
// =============================================================================
|
|
|
|
/// Extension on CqrsApiClient for health check operations
|
|
extension HealthEndpoint on CqrsApiClient {
|
|
/// Check if the API is healthy and responding
|
|
///
|
|
/// Returns a `Result<bool>` where:
|
|
/// - Success: true if API is healthy
|
|
/// - Error: ApiError with details about the failure
|
|
///
|
|
/// Example:
|
|
/// ```dart
|
|
/// final client = CqrsApiClient(config: ApiClientConfig.development);
|
|
/// final result = await client.checkHealth();
|
|
///
|
|
/// result.when(
|
|
/// success: (isHealthy) => print('API is healthy: $isHealthy'),
|
|
/// error: (error) => print('Health check failed: ${error.message}'),
|
|
/// );
|
|
/// ```
|
|
Future<Result<bool>> checkHealth() async {
|
|
return executeQuery<bool>(
|
|
endpoint: 'health',
|
|
query: const HealthQuery(),
|
|
fromJson: (json) => json as bool,
|
|
);
|
|
}
|
|
}
|
|
|
|
/// Standalone health check function for convenience
|
|
///
|
|
/// Creates a temporary client instance to perform the health check.
|
|
/// Use this when you don't have a client instance readily available.
|
|
///
|
|
/// Example:
|
|
/// ```dart
|
|
/// final result = await performHealthCheck();
|
|
/// if (result.isSuccess && result.value) {
|
|
/// print('API is ready!');
|
|
/// }
|
|
/// ```
|
|
Future<Result<bool>> performHealthCheck({
|
|
ApiClientConfig config = ApiClientConfig.development,
|
|
}) async {
|
|
final client = CqrsApiClient(config: config);
|
|
try {
|
|
return await client.checkHealth();
|
|
} finally {
|
|
client.dispose();
|
|
}
|
|
}
|