feat: Implement ApiService with Dio for standardized API requests and responses using ApiResponse entity.

This commit is contained in:
Achintha Isuru
2026-02-25 10:05:41 -05:00
parent 12211e54e2
commit 71c1610c0e
5 changed files with 162 additions and 0 deletions

View File

@@ -6,6 +6,9 @@
/// Note: Repository Interfaces are now located in their respective Feature packages.
library;
// Core
export 'src/entities/core/services/api_service/api_response.dart';
// Users & Membership
export 'src/entities/users/user.dart';
export 'src/entities/users/staff.dart';

View File

@@ -0,0 +1,22 @@
/// Represents a standardized response from the API.
class ApiResponse {
/// Creates an [ApiResponse].
const ApiResponse({
required this.code,
required this.message,
this.data,
this.errors = const <String, dynamic>{},
});
/// The response code (e.g., '200', '404', or custom error code).
final String code;
/// A descriptive message about the response.
final String message;
/// The payload returned by the API.
final dynamic data;
/// A map of field-specific error messages, if any.
final Map<String, dynamic?> errors;
}