Class SessionActParams.Input
-
- All Implemented Interfaces:
public final class SessionActParams.InputNatural language instruction or Action object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceSessionActParams.Input.VisitorAn interface that defines how to map each variant of Input to a value of type T.
-
Method Summary
Modifier and Type Method Description final Optional<String>string()final Optional<Action>action()Action object returned by observe and used by act final BooleanisString()final BooleanisAction()final StringasString()final ActionasAction()Action object returned by observe and used by act final Optional<JsonValue>_json()final <T extends Any> Taccept(SessionActParams.Input.Visitor<T> visitor)Maps this instance's current variant to a value of type T using the given visitor. final SessionActParams.Inputvalidate()Validates that the types of all values in this object match their expected types recursively. final BooleanisValid()Booleanequals(Object other)IntegerhashCode()StringtoString()final static SessionActParams.InputofString(String string)final static SessionActParams.InputofAction(Action action)Action object returned by observe and used by act -
-
Method Detail
-
accept
final <T extends Any> T accept(SessionActParams.Input.Visitor<T> visitor)
Maps this instance's current variant to a value of type T using the given visitor.
Note that this method is not forwards compatible with new variants from the API, unless visitor overrides Visitor.unknown. To handle variants not known to this version of the SDK gracefully, consider overriding Visitor.unknown:
import com.browserbase.api.core.JsonValue; import java.util.Optional; Optional<String> result = input.accept(new Input.Visitor<Optional<String>>() { @Override public Optional<String> visitString(String string) { return Optional.of(string.toString()); } // ... @Override public Optional<String> unknown(JsonValue json) { // Or inspect the `json`. return Optional.empty(); } });
-
validate
final SessionActParams.Input validate()
Validates that the types of all values in this object match their expected types recursively.
This method is not forwards compatible with new types from the API for existing fields.
-
ofString
final static SessionActParams.Input ofString(String string)
-
ofAction
final static SessionActParams.Input ofAction(Action action)
Action object returned by observe and used by act
-
-
-
-