getKeys static method

Future<Map<String, KeyStats>> getKeys({
  1. QueryType? queryType,
})

Returns the list of tag keys with statistics.

Implementation

static Future<Map<String, KeyStats>> getKeys({
  final QueryType? queryType,
}) async {
  final Map<String, String> parameters = <String, String>{};
  /* TODO "The keys list can be restricted to private tags from some owner"
  if (owner != null) {
    parameters['owner'] = owner;
  }
   */
  final Response response = await HttpHelper().doGetRequest(
    UriHelper.getFolksonomyUri(
      path: 'keys',
      queryParameters: parameters,
      queryType: queryType,
    ),
    queryType: queryType,
  );
  _checkResponse(response);
  final Map<String, KeyStats> result = <String, KeyStats>{};
  final List<dynamic> json = jsonDecode(response.body) as List<dynamic>;
  for (var element in json) {
    final KeyStats item = KeyStats.fromJson(element);
    result[item.key] = item;
  }
  return result;
}