fetchResource method

Future<ResourceFetched> fetchResource(
  1. String type,
  2. String id, {
  3. Map<String, String> headers = const {},
  4. Map<String, String> filter = const {},
  5. Iterable<String> include = const [],
  6. Map<String, Iterable<String>> fields = const {},
  7. Map<String, String> query = const {},
})

Implementation

Future<ResourceFetched> fetchResource(
  String type,
  String id, {
  Map<String, String> headers = const {},
  Map<String, String> filter = const {},
  Iterable<String> include = const [],
  Map<String, Iterable<String>> fields = const {},
  Map<String, String> query = const {},
}) async {
  final response = await send(
      baseUri.resource(type, id),
      Request.get()
        ..headers.addAll(headers)
        ..query.addAll(query)
        ..filter(filter)
        ..include(include)
        ..fields(fields));

  return ResourceFetched(
      response.http, response.document ?? (throw FormatException()));
}