convertContentBody method

Future<ContentBody> convertContentBody({
  1. required String to,
  2. String? spaceKeyContext,
  3. String? contentIdContext,
  4. String? embeddedContentRender,
  5. List<String>? expand,
  6. required ContentBodyCreate body,
})

Converts a content body from one format to another format.

Supported conversions:

  • storage: view, export_view, styled_view, editor
  • editor: storage
  • view: none
  • export_view: none
  • styled_view: none

Permissions required: If request specifies 'contentIdContext', 'View' permission for the space, and permission to view the content.

Implementation

Future<ContentBody> convertContentBody(
    {required String to,
    String? spaceKeyContext,
    String? contentIdContext,
    String? embeddedContentRender,
    List<String>? expand,
    required ContentBodyCreate body}) async {
  return ContentBody.fromJson(await _client.send(
    'post',
    'wiki/rest/api/contentbody/convert/{to}',
    pathParameters: {
      'to': to,
    },
    queryParameters: {
      if (spaceKeyContext != null) 'spaceKeyContext': spaceKeyContext,
      if (contentIdContext != null) 'contentIdContext': contentIdContext,
      if (embeddedContentRender != null)
        'embeddedContentRender': embeddedContentRender,
      if (expand != null) 'expand': expand.map((e) => e).join(','),
    },
    body: body.toJson(),
  ));
}