I have, a Salesforce packaging org, it contains a managed package with a namespace.
I need to be able to query the list of created versions for that managed package.
I am aware that a user can go to the package and click on versions, and manually see them. I need to know how to do this programmatically. Either via APEX/DML/SOQL/SOSL/API/other.
The use case: I have an automated deployment pipeline that gets initiated by a user, they specify the version of the package they intend to build in a SEPARATE org. I need to verify the version they have entered does not already exist prior to starting the automation.
----- EDIT ------
I see someone linked a previous post about getting the version of the installed managed packages, I am not looking for installed managed packages (a package installed from somewhere other than me, like the app exchange). I'm looking for the versions of packages (code) that I maintain and distribute to others as installed managed packages. Unless there is something I'm missing the other link does not solve my problem.