vinculum_client library
Vinculum Dart Client SDK
A comprehensive client SDK for interacting with Vinculum services.
Features
- Authentication (email/password, OAuth, token management)
- Database CRUD operations with query builder
- Real-time subscriptions via WebSockets
- File storage with upload/download
- Batch operations for bulk data manipulation
- SQL-like query support (CollectiveQL)
- Configurable timeouts and retry policies
- Custom headers support
Getting Started
import 'package:vinculum_client/vinculum_client.dart';
void main() async {
// Simple initialization
final client = VinculumClient(
baseUrl: 'http://localhost:8080',
);
// Or with full configuration
final configuredClient = VinculumClient.withConfig(
config: VinculumConfig(
baseUrl: 'http://localhost:8080',
timeout: Duration(seconds: 60),
maxRetries: 3,
enableLogging: true,
),
);
// Authenticate
await client.auth.login('user@example.com', 'password');
// Query database
final users = await client.database.query('users');
// Upload file
final file = await client.storage.upload(bytes, 'image.png');
// Subscribe to realtime changes
client.realtime.subscribe('users', (change) {
print('User changed: $change');
});
// Listen for auth state changes
client.authStateChanges?.listen((isAuthenticated) {
print('Auth state: $isAuthenticated');
});
// Clean up
await client.close();
}
Classes
- AuthClient
- Client for authentication operations
- AuthToken
- Authentication token response
- BatchClient
- Client for batch operations
- BatchDeleteResult
- Batch delete result
- BatchInsertResult
- Batch insert result
- BatchMixedResult
- Batch mixed result
- BatchOperation
- Batch operation
- BatchUpdateOperation
- Batch update operation
- BatchUpdateResult
- Batch update result
- DatabaseClient
- Client for database operations
- DelegatingTokenStorage
- Persistent token storage that delegates to a storage backend
- FileInfo
- File information model
- InMemoryTokenStorage
- In-memory token storage (default)
- QueryBuilder
- Query builder for constructing database queries
-
QueryResult<
T> - Query result with pagination
- RealtimeClient
- Client for realtime WebSocket operations
- RealtimeEvent
- Realtime change event
- RetryPolicy
- Retry policy for failed requests
- SqlBuilder
- Fluent SQL query builder for the SDK
- SqlQueryResult
- Result of a SQL query execution
- SqlValidationResult
- Result of SQL validation
- StorageClient
- Client for storage operations
- TokenChangeEvent
- Token change event
- TokenStorage
- Token storage interface
- User
- User model
- VinculumClient
- Main Vinculum client that provides access to all services
- VinculumConfig
- Configuration options for VinculumClient
- VinculumConfigBuilder
- Builder for creating VinculumConfig
Enums
- BatchOperationType
- Batch operation type
- RealtimeEventType
- Realtime event types
- SortOrder
- Sort order
- TokenChangeType
- Type of token change
Constants
- aggressiveRetryPolicy → const RetryPolicy
- Aggressive retry policy for critical operations
- defaultRetryPolicy → const RetryPolicy
- Default retry policy
- noRetryPolicy → const RetryPolicy
- No retry policy
Typedefs
- TokenChangeCallback = void Function(String? accessToken, String? refreshToken)
- Callback for token change events
Exceptions / Errors
- AuthException
- Authentication exception
- ConflictException
- Conflict exception (e.g., duplicate resource)
- NetworkException
- Network exception for connectivity issues
- NotFoundException
- Not found exception
- PermissionDeniedException
- Permission denied exception
- RateLimitException
- Rate limit exceeded exception
- ServerException
- Server error exception
- TimeoutException
- Timeout exception
- ValidationException
- Validation exception for invalid input
- VinculumException
- Base exception for Vinculum client errors