Class BetaWebSearchToolResultBlockContent
-
- All Implemented Interfaces:
public final class BetaWebSearchToolResultBlockContent
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceBetaWebSearchToolResultBlockContent.VisitorAn interface that defines how to map each variant of BetaWebSearchToolResultBlockContent to a value of type T.
-
Method Summary
-
-
Method Detail
-
toParam
final BetaWebSearchToolResultBlockParamContent toParam()
-
error
final Optional<BetaWebSearchToolResultError> error()
-
resultBlocks
final Optional<List<BetaWebSearchResultBlock>> resultBlocks()
-
isResultBlocks
final Boolean isResultBlocks()
-
asError
final BetaWebSearchToolResultError asError()
-
asResultBlocks
final List<BetaWebSearchResultBlock> asResultBlocks()
-
accept
final <T extends Any> T accept(BetaWebSearchToolResultBlockContent.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 = betaWebSearchToolResultBlockContent.accept(new BetaWebSearchToolResultBlockContent.Visitor<Optional<String>>() { @Override public Optional<String> visitError(BetaWebSearchToolResultError error) { return Optional.of(error.toString()); } // ... @Override public Optional<String> unknown(JsonValue json) { // Or inspect the `json`. return Optional.empty(); } });
-
validate
final BetaWebSearchToolResultBlockContent 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 BetaWebSearchToolResultBlockContent ofError(BetaWebSearchToolResultError error)
-
ofResultBlocks
final static BetaWebSearchToolResultBlockContent ofResultBlocks(List<BetaWebSearchResultBlock> resultBlocks)
-
-
-
-