getContentDescendants method

Future<ContentChildren> getContentDescendants({
  1. required String id,
  2. List<String>? expand,
})

Returns a map of the descendants of a piece of content. This is similar to Get content children, 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

The map will always include all descendant types that are valid for the content. However, if the content has no instances of a descendant type, the map will contain an empty array for that descendant type.

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

Implementation

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