fetchRelatedCollection method
Future<CollectionFetched>
fetchRelatedCollection(
- String type,
- String id,
- String relationship, {
- Map<
String, String> headers = const {}, - Map<
String, String> page = const {}, - Map<
String, String> filter = const {}, - Iterable<
String> include = const [], - Iterable<
String> sort = const [], - Map<
String, Iterable< fields = const {},String> > - Map<
String, String> query = const {},
Fetches a related resource collection
identified by type, id, relationship.
Optional arguments:
headers- any extra HTTP headersquery- any extra query parameterspage- pagination optionsfilter- filtering optionsinclude- request to include related resourcessort- collection sorting optionsfields- sparse fields options
Implementation
Future<CollectionFetched> fetchRelatedCollection(
String type,
String id,
String relationship, {
Map<String, String> headers = const {},
Map<String, String> page = const {},
Map<String, String> filter = const {},
Iterable<String> include = const [],
Iterable<String> sort = const [],
Map<String, Iterable<String>> fields = const {},
Map<String, String> query = const {},
}) async {
final response = await send(
baseUri.related(type, id, relationship),
Request.get()
..headers.addAll(headers)
..query.addAll(query)
..page(page)
..filter(filter)
..include(include)
..sort(sort)
..fields(fields));
return CollectionFetched(
response.http, response.document ?? (throw FormatException()));
}