Package com.anthropic.models.messages
Class WebSearchToolResultBlockContent
-
- All Implemented Interfaces:
public final class WebSearchToolResultBlockContent
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceWebSearchToolResultBlockContent.VisitorAn interface that defines how to map each variant of WebSearchToolResultBlockContent to a value of type T.
-
Method Summary
Modifier and Type Method Description final WebSearchToolResultBlockParamContenttoParam()final Optional<WebSearchToolResultError>error()final Optional<List<WebSearchResultBlock>>resultBlocks()final BooleanisError()final BooleanisResultBlocks()final WebSearchToolResultErrorasError()final List<WebSearchResultBlock>asResultBlocks()final Optional<JsonValue>_json()final <T extends Any> Taccept(WebSearchToolResultBlockContent.Visitor<T> visitor)Maps this instance's current variant to a value of type T using the given visitor. final WebSearchToolResultBlockContentvalidate()Validates that the types of all values in this object match their expected types recursively. final BooleanisValid()Booleanequals(Object other)IntegerhashCode()StringtoString()final static WebSearchToolResultBlockContentofError(WebSearchToolResultError error)final static WebSearchToolResultBlockContentofResultBlocks(List<WebSearchResultBlock> resultBlocks)-
-
Method Detail
-
toParam
final WebSearchToolResultBlockParamContent toParam()
-
error
final Optional<WebSearchToolResultError> error()
-
resultBlocks
final Optional<List<WebSearchResultBlock>> resultBlocks()
-
isResultBlocks
final Boolean isResultBlocks()
-
asError
final WebSearchToolResultError asError()
-
asResultBlocks
final List<WebSearchResultBlock> asResultBlocks()
-
accept
final <T extends Any> T accept(WebSearchToolResultBlockContent.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 = webSearchToolResultBlockContent.accept(new WebSearchToolResultBlockContent.Visitor<Optional<String>>() { @Override public Optional<String> visitError(WebSearchToolResultError error) { return Optional.of(error.toString()); } // ... @Override public Optional<String> unknown(JsonValue json) { // Or inspect the `json`. return Optional.empty(); } });
-
validate
final WebSearchToolResultBlockContent 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.
-
ofError
final static WebSearchToolResultBlockContent ofError(WebSearchToolResultError error)
-
ofResultBlocks
final static WebSearchToolResultBlockContent ofResultBlocks(List<WebSearchResultBlock> resultBlocks)
-
-
-
-