feat: Implement ApiService with Dio for standardized API requests and responses using ApiResponse entity.
This commit is contained in:
@@ -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';
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user