How to add a comment for the page version created?

I am trying to find the Java API that will add a comment on the “Page History” Page under the comment column. So what I am doing is when something on my macro changes, I force the page update like so:

pageManager.<Page>saveNewVersion(page, page1 -> page1.setBodyContent(content));

As expected the page gets updated with a new version.

But I want to add a comment in the “Comment” column of the “Page History” page stating something like “The page version was created because the macro content was changed”. Please advise if there is any Java API I can use to achieve this.

found the solution that fits my needs:

pageManager.<Page>saveNewVersion(page, page1 -> {
    page1.setVersionComment("Version created by the plugin");
1 Like