getAndAsyncConvertMacroBodyByMacroId method

Future<AsyncId> getAndAsyncConvertMacroBodyByMacroId({
  1. required String id,
  2. required int version,
  3. required String macroId,
  4. required String to,
  5. List<String>? expand,
  6. bool? allowCache,
  7. String? spaceKeyContext,
  8. String? embeddedContentRender,
})

Returns Async Id of the conversion task which will convert the macro into a content body of the desired format. The result will be available for 5 minutes after completion of the conversion.

About the macro ID: When a macro is created in a new version of content, Confluence will generate a random ID for it, unless an ID is specified (by an app). The macro ID will look similar to this: '884bd9-0cb8-41d5-98be-f80943c14f96'. The ID is then persisted as new versions of content are created, and is only modified by Confluence if there are conflicting IDs.

Note, to preserve backwards compatibility this resource will also match on the hash of the macro body, even if a macro ID is found. This check will eventually become redundant, as macro IDs are generated for pages and transparently propagate out to all instances.

Permissions required: Permission to view the content that the macro is in.

Implementation

Future<AsyncId> getAndAsyncConvertMacroBodyByMacroId(
    {required String id,
    required int version,
    required String macroId,
    required String to,
    List<String>? expand,
    bool? allowCache,
    String? spaceKeyContext,
    String? embeddedContentRender}) async {
  return AsyncId.fromJson(await _client.send(
    'get',
    'wiki/rest/api/content/{id}/history/{version}/macro/id/{macroId}/convert/async/{to}',
    pathParameters: {
      'id': id,
      'version': '$version',
      'macroId': macroId,
      'to': to,
    },
    queryParameters: {
      if (expand != null) 'expand': expand.map((e) => e).join(','),
      if (allowCache != null) 'allowCache': '$allowCache',
      if (spaceKeyContext != null) 'spaceKeyContext': spaceKeyContext,
      if (embeddedContentRender != null)
        'embeddedContentRender': embeddedContentRender,
    },
  ));
}