Hue api v2 : how to get all the possible scene states to cycle through in javascript?

I would like to cycle through the scenes, for example when I click a button, going to the next scene and if there is no more scenes, to the first in the list


var itemName = "myItem"; // Name of item that corresponds to a hue scene string
//in the UI I can choose between different scene names

var item = items.getItem(itemName);

var logger = Java.type("org.slf4j.LoggerFactory").getLogger("org.openhab.model.script.Rules.ListCommands");

var options =     //how do I get the list of possible string values here ??
var scenes= options.map(option => option.value).join(", ");
logger.info("Possible scenes for item " + itemName + " : " + scenes);

thanks for the help!

@remisharrock sorry for the delay; I had not noticed your post.

You can fetch the available state options for an Item via the openHAB Rest API. See example below.

// request
http://192.168.x.yyy:8080/rest/items/Kitchen_Scene

// response
{
  "link": "http://192.168.x.yyy:8080/rest/items/Kitchen_Scene",
  "state": "NULL",
  "stateDescription": {
    "pattern": "%s",
    "readOnly": false,
    "options": [
      {
        "value": "Relax",
        "label": "Relax"
      },
      {
        "value": "Energise",
        "label": "Energise"
      },
      {
        "value": "Bright",
        "label": "Bright"
      },
      {
        "value": "Read",
        "label": "Read"
      },
      {
        "value": "Nightlight",
        "label": "Nightlight"
      },
      {
        "value": "Concentrate",
        "label": "Concentrate"
      }
    ]
  },
  "commandDescription": {
    "commandOptions": [
      {
        "command": "Relax",
        "label": "Relax"
      },
      {
        "command": "Energise",
        "label": "Energise"
      },
      {
        "command": "Bright",
        "label": "Bright"
      },
      {
        "command": "Read",
        "label": "Read"
      },
      {
        "command": "Nightlight",
        "label": "Nightlight"
      },
      {
        "command": "Concentrate",
        "label": "Concentrate"
      }
    ]
  },
  "metadata": {
    "semantics": {
      "value": "Point"
    }
  },
  "editable": true,
  "type": "String",
  "name": "Kitchen_Scene",
  "label": "Scene",
  "category": "MediaControl",
  "tags": [
    "Point"
  ],
  "groupNames": []
}