3

I'm calling an API that returns a large hash/object. I have two questions:

  1. In order to refer to the keys/values of that hash (e.g., in a dialogue), do I have to convert the hash into a structure? (Or is there a way to access the object "directly.")

  2. If I do have to convert the hash into a Bixby structure, is there some way to do that programatically?

Right now, I've created a whole bunch of primitives for all of the keys in the object, and then a structure with all those primitives as properties. I hope there's something that I'm missing, since the returned hash might have 100's of keys.

sarkon
  • 187
  • 2
  • 8

1 Answers1

1

In order to refer to the keys/values of that hash (e.g., in a dialogue), do I have to convert the hash into a structure? (Or is there a way to access the object "directly.")

Yes you must define a structure if you wish to do this.

If I do have to convert the hash into a Bixby structure, is there some way to do that programatically?

Not at this time, no. To save yourself some pain of having to create 100s of different models for each field in the hash, you can use the visibility key to reuse concepts.

For example,

structure (Group) {
  description (Represents a group.)
  property (id) {
    type (viv.core.Text) // Normally you can't have two properties of the same type.
    min (Required) max (One)
    visibility (Private) // But with this key, the planner cannot see this concept and won't be confused.
  }
  property (name) {
    type (viv.core.Text) 
    min (Required) max (One)
    visibility (Private)
  }
(more properties here)
}

Yet another option is to just generate the dialogue in JavaScript, and have a "dialog" field for whatever you want to say. This might be the way to go, unless you have a specific need to model out 100's of different fields in your model and wish to use them in the planner.

dogethis
  • 519
  • 6
  • 15