How to change page mode from the plugin API

I am currently working on a plugin using the Figma API, and I’m facing some challenges in finding a way to access the Figma page mode that I’m currently on. I need to access the page layer mode and be able to change the mode in the plugin.

Can anyone help?

Currently, the PageNode does not have a getter and setter for variable mode. But it is still possible to get the applied modes via the REST API (or by exporting the page in the JSON_REST_V1 format).

Released in Version 1, Update 83.