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>
91 lines
2.2 KiB
Dart
91 lines
2.2 KiB
Dart
/// Svrnty Console API Client Library
|
|
///
|
|
/// Type-safe CQRS API client for communicating with the backend.
|
|
///
|
|
/// This library provides:
|
|
/// - CQRS pattern support (queries, commands, paginated queries)
|
|
/// - Functional error handling with Result<T>
|
|
/// - Type-safe serialization via Serializable interface
|
|
/// - OpenAPI contract-driven development
|
|
///
|
|
/// ## Quick Start
|
|
///
|
|
/// ```dart
|
|
/// import 'package:console/api/api.dart';
|
|
///
|
|
/// // Create client
|
|
/// final client = CqrsApiClient(
|
|
/// config: ApiClientConfig.development,
|
|
/// );
|
|
///
|
|
/// // Execute query
|
|
/// final result = await client.checkHealth();
|
|
///
|
|
/// result.when(
|
|
/// success: (isHealthy) => print('API healthy: $isHealthy'),
|
|
/// error: (error) => print('Error: ${error.message}'),
|
|
/// );
|
|
///
|
|
/// // Clean up
|
|
/// client.dispose();
|
|
/// ```
|
|
///
|
|
/// ## CQRS Patterns
|
|
///
|
|
/// ### Queries (Read)
|
|
/// ```dart
|
|
/// final result = await client.executeQuery<UserDto>(
|
|
/// endpoint: 'users/123',
|
|
/// query: GetUserQuery(userId: '123'),
|
|
/// fromJson: UserDto.fromJson,
|
|
/// );
|
|
/// ```
|
|
///
|
|
/// ### Commands (Write)
|
|
/// ```dart
|
|
/// final result = await client.executeCommand(
|
|
/// endpoint: 'createUser',
|
|
/// command: CreateUserCommand(name: 'John', email: 'john@example.com'),
|
|
/// );
|
|
/// ```
|
|
///
|
|
/// ### Paginated Queries (Lists)
|
|
/// ```dart
|
|
/// final result = await client.executePaginatedQuery<UserDto>(
|
|
/// endpoint: 'users',
|
|
/// query: ListUsersQuery(),
|
|
/// itemFromJson: UserDto.fromJson,
|
|
/// page: 1,
|
|
/// pageSize: 20,
|
|
/// );
|
|
/// ```
|
|
///
|
|
/// See [README_API.md] for complete documentation.
|
|
library;
|
|
|
|
// Core exports
|
|
export 'client.dart' show CqrsApiClient, ApiClientConfig;
|
|
export 'types.dart'
|
|
show
|
|
// Result type
|
|
Result,
|
|
ApiSuccess,
|
|
ApiError,
|
|
// Error types
|
|
ApiErrorInfo,
|
|
ApiErrorType,
|
|
// Pagination
|
|
PaginatedResponse,
|
|
PageInfo,
|
|
FilterCriteria,
|
|
FilterOperator,
|
|
SortCriteria,
|
|
SortDirection,
|
|
// Serialization
|
|
Serializable,
|
|
// Queries (from schema)
|
|
HealthQuery;
|
|
|
|
// Endpoint extensions
|
|
export 'endpoints/health_endpoint.dart' show HealthEndpoint, performHealthCheck;
|