IntraApi class
Base class for intra-service API communication.
This class extends BaseApi functionality with URL joining capabilities. Each service extends IntraApi with a configured baseUrl for making API calls to specific microservice endpoints.
Usage
class VouchersService extends IntraApi {
static final VouchersService instance = VouchersService();
VouchersService() : super('https://vouchers.tsdtech.com');
Future<ValueResult<List<Voucher>>> getVouchers() async { ... }
}
URL Handling
The joinUrl method ensures proper URL construction by:
- Removing trailing slashes from baseUrl
- Adding leading slash to path if missing
- Concatenating without duplicate slashes
Constructors
Properties
Methods
-
delete(
String path, {Object? data, Map< String, dynamic> ? headers}) → Future<Response> -
Performs a DELETE request to the specified
pathon this service's base URL. -
get(
String path, {Map< String, dynamic> ? queryParameters, Map<String, dynamic> ? headers}) → Future<Response> -
Performs a GET request to the specified
pathon this service's base URL. -
joinUrl(
String baseUrl, String path) → String -
Joins a
baseUrlandpathinto a single URL string. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
patch(
String path, {Object? data, Map< String, dynamic> ? headers}) → Future<Response> -
Performs a PATCH request to the specified
pathon this service's base URL. -
post(
String path, {Object? data, Map< String, dynamic> ? headers}) → Future<Response> -
Performs a POST request to the specified
pathon this service's base URL. -
put(
String path, {Object? data, Map< String, dynamic> ? headers}) → Future<Response> -
Performs a PUT request to the specified
pathon this service's base URL. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited