I haven’t found a relevant UNO command to directly create captions. Currently, the process of creating captions involves sending a popup UNO command and then allowing the user to select the caption configuration. However, I am working in a Python script environment and do not want any popups. I want to directly add captions to image or table objects.
Captions are a UI feature, once you insert it, a caption is just a Writer TextFrame that contains the table / image and has an additional paragraph at a bottom the caption text.
It seems that currently .uno:InsertCaptionDialog doesn’t take any parameters, see here:
So either you would have to extend that, so it’s not interactive when you pass parameters or you would have to create the TextFrame manually, similar to what the ODT import does.