Package com.anthropic.models.messages
Class WebSearchToolResultBlockParamContent
-
- All Implemented Interfaces:
public final class WebSearchToolResultBlockParamContent
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceWebSearchToolResultBlockParamContent.VisitorAn interface that defines how to map each variant of WebSearchToolResultBlockParamContent to a value of type T.
-
Method Summary
Modifier and Type Method Description final Optional<List<WebSearchResultBlockParam>>item()final Optional<WebSearchToolRequestError>requestError()final BooleanisItem()final BooleanisRequestError()final List<WebSearchResultBlockParam>asItem()final WebSearchToolRequestErrorasRequestError()final Optional<JsonValue>_json()final <T extends Any> Taccept(WebSearchToolResultBlockParamContent.Visitor<T> visitor)Maps this instance's current variant to a value of type T using the given visitor. final WebSearchToolResultBlockParamContentvalidate()Validates that the types of all values in this object match their expected types recursively. final BooleanisValid()Booleanequals(Object other)IntegerhashCode()StringtoString()final static WebSearchToolResultBlockParamContentofItem(List<WebSearchResultBlockParam> item)final static WebSearchToolResultBlockParamContentofRequestError(WebSearchToolRequestError requestError)-
-
Method Detail
-
item
final Optional<List<WebSearchResultBlockParam>> item()
-
requestError
final Optional<WebSearchToolRequestError> requestError()
-
isRequestError
final Boolean isRequestError()
-
asItem
final List<WebSearchResultBlockParam> asItem()
-
asRequestError
final WebSearchToolRequestError asRequestError()
-
accept
final <T extends Any> T accept(WebSearchToolResultBlockParamContent.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.anthropic.core.JsonValue; import java.util.Optional; Optional<String> result = webSearchToolResultBlockParamContent.accept(new WebSearchToolResultBlockParamContent.Visitor<Optional<String>>() { @Override public Optional<String> visitItem(List<WebSearchResultBlockParam> item) { return Optional.of(item.toString()); } // ... @Override public Optional<String> unknown(JsonValue json) { // Or inspect the `json`. return Optional.empty(); } });
-
validate
final WebSearchToolResultBlockParamContent 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.
-
ofItem
final static WebSearchToolResultBlockParamContent ofItem(List<WebSearchResultBlockParam> item)
-
ofRequestError
final static WebSearchToolResultBlockParamContent ofRequestError(WebSearchToolRequestError requestError)
-
-
-
-