Re-ordering variant properties programatically


I’ve created a plugin that generates component sets, and I want to re-order the values for one of the variant properties through the plugin API.

I found this article in the help section that shows how to accomplish this through the UI, but I haven’t found any docs that show how to accomplish this programatically.

Is this possible to do with a plugin?