getDescendantsOfType method

Future<ContentArray> getDescendantsOfType({
  1. required String id,
  2. required String type,
  3. String? depth,
  4. List<String>? expand,
  5. int? start,
  6. int? limit,
})

Returns all descendants of a given type, for a piece of content. This is similar to Get content children by type, except that this method returns child pages at all levels, rather than just the direct child pages.

A piece of content has different types of descendants, depending on its type:

  • page: descendant is page, comment, attachment
  • blogpost: descendant is comment, attachment
  • attachment: descendant is comment
  • comment: descendant is attachment

Custom content types that are provided by apps can also be returned.

Permissions required: 'View' permission for the space, and permission to view the content if it is a page.

Implementation

Future<ContentArray> getDescendantsOfType(
    {required String id,
    required String type,
    String? depth,
    List<String>? expand,
    int? start,
    int? limit}) async {
  return ContentArray.fromJson(await _client.send(
    'get',
    'wiki/rest/api/content/{id}/descendant/{type}',
    pathParameters: {
      'id': id,
      'type': type,
    },
    queryParameters: {
      if (depth != null) 'depth': depth,
      if (expand != null) 'expand': expand.map((e) => e).join(','),
      if (start != null) 'start': '$start',
      if (limit != null) 'limit': '$limit',
    },
  ));
}