Bixby Developer Center

Guides
References

lazy-source

optionalmultiple allowedvalue required

Associates a Fetch action with a property, which is called asynchronously to populate the property with data on demand.

Sometimes it is too expensive to populate a property of a structure with the original API call in a Search action. In these cases, you can declare that a property have an associated lazy-source action, which can perform an asynchronous fetch of the property's data on demand. Bixby calls the lazy source when the property is referenced either in a layout or dialog. Once Bixby calls the lazy action, the property data is cached with the rest of the structure, resulting in only one lazy fetch call.

property (%name%) {
type (%type%)
lazy-source (%lazy-action%)
}

Example

Suppose you declare Hotel to have lazy property called details, of type HotelDetails. In this case, you don't want to fetch the details for a hotel when doing the original search action and instead prefer to fetch the details on demand.

structure (Hotel) {

description(A hotel business.)

property (details) {
type (HotelDetails)
lazy-source (GetHotelDetails)
min(Optional) max(One)
}
...
}

The action is declared as a Fetch type and contains one input corresponding to the type of the parent structure Hotel. Once the lazy action is called and returns a HotelDetails, the returning structure will be assigned to the Hotel's details property and cached for subsequent use.

action (GetHotelDetails) {
type (Fetch)

description (Retrieves any additional details about this hotel.)
collect {
input (hotel) {
type(Hotel)
min(Required) max(One)
}
}
output (HotelDetails)
}