getLinks method

Future<List<ContentLink>> getLinks({
  1. String? startsWith,
  2. String? parentID,
  3. bool? includeDates,
  4. Pagination? pagination,
})

Implementation

Future<List<ContentLink>> getLinks({
  String? startsWith,
  String? parentID,
  bool? includeDates,
  Pagination? pagination,
}) async {
  final json = await _getRequest(
    path: _pathLinks,
    queryParameters: {
      if (startsWith != null) "starts_with": startsWith,
      if (_version != null) "version": _version.name,
      if (_cacheVersion != null) "cv": _cacheVersion.toString(),
      if (parentID != null) "with_parent": parentID,
      if (includeDates != null) "include_dates": includeDates ? "1" : "0",
      if (pagination != null) ...pagination.toParameters(),
      "paginated": "1",
    },
  );
  return List<JSONMap>.from(json["links"]).map(ContentLink.fromJson).toList();
}