Both options leverage ARM REST APIs to perform discovery and automate the process of importing a function app (or logic app even) into APIM. You can see the various requests made in the developer console of your browser.
Unfortunately, the same isn't available in the CLI or PowerShell cmdlets. Please feel free to raise a feature request to include support for the same.
The recommended way as highlighted in the Azure APIM DevOps Resource Kit is to author and maintain OpenAPI Specs + ARM Templates to automate the deployment of APIM and its sub-resources (like APIs, Products, etc.), which you could build upon for your own requirements.