Class BetaManagedAgentsImageBlock.Source
-
- All Implemented Interfaces:
public final class BetaManagedAgentsImageBlock.SourceThe source of the image data.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceBetaManagedAgentsImageBlock.Source.VisitorAn interface that defines how to map each variant of Source to a value of type T.
public final classBetaManagedAgentsImageBlock.Source.Type
-
Method Summary
Modifier and Type Method Description final Optional<BetaManagedAgentsBase64ImageSource>base64()Base64-encoded image data. final Optional<BetaManagedAgentsUrlImageSource>url()Image referenced by URL. final Optional<BetaManagedAgentsFileImageSource>file()Image referenced by file ID. final Optional<JsonValue>_json()final BetaManagedAgentsImageBlock.Source.Typetype()final BooleanisBase64()final BooleanisUrl()final BooleanisFile()final BetaManagedAgentsBase64ImageSourceasBase64()Base64-encoded image data. final BetaManagedAgentsUrlImageSourceasUrl()Image referenced by URL. final BetaManagedAgentsFileImageSourceasFile()Image referenced by file ID. final <T extends Any> Taccept(BetaManagedAgentsImageBlock.Source.Visitor<T> visitor)Maps this instance's current variant to a value of type T using the given visitor. final BetaManagedAgentsImageBlock.Sourcevalidate()Validates that the types of all values in this object match their expected types recursively. final BooleanisValid()Booleanequals(Object other)IntegerhashCode()StringtoString()final static BetaManagedAgentsImageBlock.SourceofBase64(BetaManagedAgentsBase64ImageSource base64)Base64-encoded image data. final static BetaManagedAgentsImageBlock.SourceofUrl(BetaManagedAgentsUrlImageSource url)Image referenced by URL. final static BetaManagedAgentsImageBlock.SourceofUrl(String url)Returns an immutable instance of Source whose ofUrl variant is built from the given required url. final static BetaManagedAgentsImageBlock.SourceofFile(BetaManagedAgentsFileImageSource file)Image referenced by file ID. final static BetaManagedAgentsImageBlock.SourceofFile(String fileId)Returns an immutable instance of Source whose ofFile variant is built from the given required fileId. -
-
Method Detail
-
base64
final Optional<BetaManagedAgentsBase64ImageSource> base64()
Base64-encoded image data.
-
url
final Optional<BetaManagedAgentsUrlImageSource> url()
Image referenced by URL.
-
file
final Optional<BetaManagedAgentsFileImageSource> file()
Image referenced by file ID.
-
type
final BetaManagedAgentsImageBlock.Source.Type type()
-
asBase64
final BetaManagedAgentsBase64ImageSource asBase64()
Base64-encoded image data.
-
asUrl
final BetaManagedAgentsUrlImageSource asUrl()
Image referenced by URL.
-
asFile
final BetaManagedAgentsFileImageSource asFile()
Image referenced by file ID.
-
accept
final <T extends Any> T accept(BetaManagedAgentsImageBlock.Source.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 = source.accept(new Source.Visitor<Optional<String>>() { @Override public Optional<String> visitBase64(BetaManagedAgentsBase64ImageSource base64) { return Optional.of(base64.toString()); } // ... @Override public Optional<String> unknown(JsonValue json) { // Or inspect the `json`. return Optional.empty(); } });
-
validate
final BetaManagedAgentsImageBlock.Source 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.
-
ofBase64
final static BetaManagedAgentsImageBlock.Source ofBase64(BetaManagedAgentsBase64ImageSource base64)
Base64-encoded image data.
-
ofUrl
final static BetaManagedAgentsImageBlock.Source ofUrl(BetaManagedAgentsUrlImageSource url)
Image referenced by URL.
-
ofUrl
final static BetaManagedAgentsImageBlock.Source ofUrl(String url)
-
ofFile
final static BetaManagedAgentsImageBlock.Source ofFile(BetaManagedAgentsFileImageSource file)
Image referenced by file ID.
-
-
-
-