copyPage method

Future<Content> copyPage({
  1. required String id,
  2. List<String>? expand,
  3. required CopyPageRequest body,
})

Copies a single page and its associated properties, permissions, attachments, and custom contents. The id path parameter refers to the content ID of the page to copy. The target of the page to be copied is defined using the destination in the request body and can be one of the following types.

  • space: page will be copied to the specified space as a root page on the space
  • parent_page: page will be copied as a child of the specified parent page
  • existing_page: page will be copied and replace the specified page

By default, the following objects are expanded: space, history, version.

Permissions required: 'Add' permission for the space that the content will be copied in and permission to update the content if copying to an existing_page.

Implementation

Future<Content> copyPage(
    {required String id,
    List<String>? expand,
    required CopyPageRequest body}) async {
  return Content.fromJson(await _client.send(
    'post',
    'wiki/rest/api/content/{id}/copy',
    pathParameters: {
      'id': id,
    },
    queryParameters: {
      if (expand != null) 'expand': expand.map((e) => e).join(','),
    },
    body: body.toJson(),
  ));
}