fetchCollection method
Fetches a primary collection of type type
.
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> fetchCollection(
String type, {
Map<String, String> headers = const {},
Map<String, String> query = 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 {},
}) async {
final response = await send(
baseUri.collection(type),
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()));
}