modular_api_rest_client 0.6.0 copy "modular_api_rest_client: ^0.6.0" to clipboard
modular_api_rest_client: ^0.6.0 copied to clipboard

Official MACSS outbound REST client for Dart.

modular_api_rest_client #

Official MACSS outbound REST client for Dart.

Quick start #

import 'package:modular_api_rest_client/modular_api_rest_client.dart';

final result = await httpClient<Map<String, Object?>>(
  config: ServiceClientConfig(
    serviceId: 'users',
    baseUrl: Uri.parse('https://api.example.test'),
    redactedSummary: 'users@example',
    defaultHeaders: const {'accept': 'application/json'},
  ),
  request: const ServiceRequest(
    operationId: 'users.list',
    method: 'GET',
    path: '/users',
  ),
  decoder: (json) => Map<String, Object?>.from(json as Map),
);

if (result.isSuccess) {
  print(result.value.data);
} else {
  print(result.failure.message);
}

Current slice #

  • normalized ServiceResult<T> and ServiceFailure
  • persistent HttpServiceClient
  • one-shot httpClient() helper
  • explicit request metadata via ServiceRequest
  • JSON-first response decoding and HTTP metadata preservation
0
likes
140
points
165
downloads

Documentation

API reference

Publisher

verified publisherccisne.dev

Weekly Downloads

Official MACSS outbound REST client for Dart.

Homepage
Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

http

More

Packages that depend on modular_api_rest_client