Class BetaMessageBatchResult
-
- All Implemented Interfaces:
public final class BetaMessageBatchResultProcessing result for this request.
Contains a Message output if processing was successful, an error response if processing failed, or the reason why processing was not attempted, such as cancellation or expiration.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceBetaMessageBatchResult.VisitorAn interface that defines how to map each variant of BetaMessageBatchResult to a value of type T.
-
Method Summary
-
-
Method Detail
-
succeeded
final Optional<BetaMessageBatchSucceededResult> succeeded()
-
errored
final Optional<BetaMessageBatchErroredResult> errored()
-
canceled
final Optional<BetaMessageBatchCanceledResult> canceled()
-
expired
final Optional<BetaMessageBatchExpiredResult> expired()
-
isSucceeded
final Boolean isSucceeded()
-
isCanceled
final Boolean isCanceled()
-
asSucceeded
final BetaMessageBatchSucceededResult asSucceeded()
-
asErrored
final BetaMessageBatchErroredResult asErrored()
-
asCanceled
final BetaMessageBatchCanceledResult asCanceled()
-
asExpired
final BetaMessageBatchExpiredResult asExpired()
-
accept
final <T extends Any> T accept(BetaMessageBatchResult.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 = betaMessageBatchResult.accept(new BetaMessageBatchResult.Visitor<Optional<String>>() { @Override public Optional<String> visitSucceeded(BetaMessageBatchSucceededResult succeeded) { return Optional.of(succeeded.toString()); } // ... @Override public Optional<String> unknown(JsonValue json) { // Or inspect the `json`. return Optional.empty(); } });
-
validate
final BetaMessageBatchResult 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.
-
ofSucceeded
final static BetaMessageBatchResult ofSucceeded(BetaMessageBatchSucceededResult succeeded)
-
ofErrored
final static BetaMessageBatchResult ofErrored(BetaMessageBatchErroredResult errored)
-
ofCanceled
final static BetaMessageBatchResult ofCanceled(BetaMessageBatchCanceledResult canceled)
-
ofExpired
final static BetaMessageBatchResult ofExpired(BetaMessageBatchExpiredResult expired)
-
-
-
-