How to reproduce "Zoom Extents" with C++ API

I would like to create a scene with a object and place the camera to fit on the object similar to “zoom extents”. Is this feature exist on the API?

Thanks for your help.