getKeys static method

Future<Map<String, KeyStats>> getKeys({
  1. String? owner,
  2. UriHelper uriHelper = uriHelperFolksonomyProd,
})

Returns the list of tag keys with statistics.

Implementation

static Future<Map<String, KeyStats>> getKeys({
  final String? owner,
  final UriHelper uriHelper = uriHelperFolksonomyProd,
}) async {
  final Map<String, String> parameters = <String, String>{
    if (owner != null) 'owner': owner,
  };
  final Response response = await HttpHelper().doGetRequest(
    uriHelper.getUri(
      path: 'keys',
      queryParameters: parameters,
    ),
    uriHelper: uriHelper,
  );
  _checkResponse(response);
  final Map<String, KeyStats> result = <String, KeyStats>{};
  final List<dynamic> json =
      HttpHelper().jsonDecode(response.body) as List<dynamic>;
  for (var element in json) {
    final KeyStats item = KeyStats.fromJson(element);
    result[item.key] = item;
  }
  return result;
}