Unity - Manual: Scripting API for packages
You can use the Package Manager scripting API to interact with the Package Manager using C# scriptsA piece of code that allows you to create your own Components, trigger game events, modify Component properties over time and respond to user input in any way you like. More infoSee in Glossary. For example, you might want to install a specific package or version depending on the platform of the target machine.