Create a share link to an iCloud Drive file programatically?

Hi,
maybe I'm blind or using the wrong search terms but is there no way for an application on macOS to programatically copy a file to iCloud Drive and to generate a share link for that file?

I know I could tell the user how to do it manually via Finder, but the comfort lies in pressing a single button in the application and getting back to the user with a ready-made link.

Could anyone enlighten me or point me into the right direction?
Create a share link to an iCloud Drive file programatically?
 
 
Q