Class MacroResource

java.lang.Object
com.atlassian.confluence.tinymceplugin.rest.MacroResource

@Path("/macro") public class MacroResource extends Object
  • Constructor Details

  • Method Details

    • generatePlaceHolder

      @POST @Path("/placeholder") @Consumes("application/json") @Produces("text/plain") public javax.ws.rs.core.Response generatePlaceHolder(MacroRenderRequest renderRequest)
    • generatePlaceHolderForStoredMacro

      @POST @Path("/placeholder/storedmacro") @Consumes("application/json") @Produces("text/plain") public javax.ws.rs.core.Response generatePlaceHolderForStoredMacro(MacroRenderByIdRequest renderByIdRequest)
      Retrieves the stored macro in the editor format.

      This method allows users to access stored macros in the editor format. This can be used when copying a macro from view mode into editor mode.

      The placeholder API was not reused because of the following reasons: The input required for both APIs is completely different, making it necessary to create a separate method. One API is designed for obtaining an empty placeholder, while the other is specifically for retrieving a saved macro. The existing API is already being utilized in multiple places on the front end, complicating any updates to the interface. Handling the validation logic for the different inputs would also be complex, further justifying the need for a new API.

      Parameters:
      renderByIdRequest - the MacroRenderByIdRequest object containing the macroId, contentId, versionId, and hostId for the macro retrieval
      Returns:
      a Response object representing a macro in the string format
      Throws:
      IllegalArgumentException - if either macroId, versionId, or hostId is null
    • generateDefinition

      @POST @Path("/definition") @Consumes("application/json") @Produces("application/json") public javax.ws.rs.core.Response generateDefinition(UnmarshalMacroRequest unmarshalMacroRequest)
    • generatePreview

      @POST @Path("/preview") @Consumes("application/json") @Produces("text/plain") public javax.ws.rs.core.Response generatePreview(PreviewMacroRequest previewMacroRequest)