Class BrowserStateChange
-
- All Implemented Interfaces:
public final class BrowserStateChange
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceBrowserStateChange.VisitorAn interface that defines how to map each variant of BrowserStateChange to a value of type T.
public final classBrowserStateChange.Type
-
Method Summary
Modifier and Type Method Description final Optional<BrowserStateChangeTabOpened>tabOpened()A tab this call's execution opened that remains open at its end — the creation delta of the tabsinventory, not an event log.final Optional<BrowserStateChangeDownloadStarted>downloadStarted()A file download that started during this call. final Optional<BrowserStateChangeDownloadCompleted>downloadCompleted()A file download that finished during this call, reported with the same download_idas itsdownload_started— or without a priordownload_started, when the download finished during the call that started it (at most one state change perdownload_idper result).final Optional<BrowserStateChangeDownloadFailed>downloadFailed()A file download that failed — or was cancelled — during this call. final Optional<JsonValue>_json()final BrowserStateChange.Typetype()final Optional<String>downloadId()final Optional<String>url()final BooleanisTabOpened()final BooleanisDownloadStarted()final BooleanisDownloadCompleted()final BooleanisDownloadFailed()final BrowserStateChangeTabOpenedasTabOpened()A tab this call's execution opened that remains open at its end — the creation delta of the tabsinventory, not an event log.final BrowserStateChangeDownloadStartedasDownloadStarted()A file download that started during this call. final BrowserStateChangeDownloadCompletedasDownloadCompleted()A file download that finished during this call, reported with the same download_idas itsdownload_started— or without a priordownload_started, when the download finished during the call that started it (at most one state change perdownload_idper result).final BrowserStateChangeDownloadFailedasDownloadFailed()A file download that failed — or was cancelled — during this call. final <T extends Any> Taccept(BrowserStateChange.Visitor<T> visitor)Maps this instance's current variant to a value of type T using the given visitor. final BrowserStateChangevalidate()Validates that the types of all values in this object match their expected types recursively. final BooleanisValid()Booleanequals(Object other)IntegerhashCode()StringtoString()final static BrowserStateChangeofTabOpened(BrowserStateChangeTabOpened tabOpened)A tab this call's execution opened that remains open at its end — the creation delta of the tabsinventory, not an event log.final static BrowserStateChangeofTabOpened(String tabId)Returns an immutable instance of BrowserStateChange whose ofTabOpened variant is built from the given required tabId. final static BrowserStateChangeofDownloadStarted(BrowserStateChangeDownloadStarted downloadStarted)A file download that started during this call. final static BrowserStateChangeofDownloadCompleted(BrowserStateChangeDownloadCompleted downloadCompleted)A file download that finished during this call, reported with the same download_idas itsdownload_started— or without a priordownload_started, when the download finished during the call that started it (at most one state change perdownload_idper result).final static BrowserStateChangeofDownloadFailed(BrowserStateChangeDownloadFailed downloadFailed)A file download that failed — or was cancelled — during this call. -
-
Method Detail
-
tabOpened
final Optional<BrowserStateChangeTabOpened> tabOpened()
A tab this call's execution opened that remains open at its end — the creation delta of the
tabsinventory, not an event log.Carries only the
tab_id; the tab'stitleandurllive on itstabsentry, which must include the sametab_id. A tab opened during a failed call gets no deferredtab_opened; it simply appears in the next result'stabsinventory.
-
downloadStarted
final Optional<BrowserStateChangeDownloadStarted> downloadStarted()
A file download that started during this call.
-
downloadCompleted
final Optional<BrowserStateChangeDownloadCompleted> downloadCompleted()
A file download that finished during this call, reported with the same
download_idas itsdownload_started— or without a priordownload_started, when the download finished during the call that started it (at most one state change perdownload_idper result).
-
downloadFailed
final Optional<BrowserStateChangeDownloadFailed> downloadFailed()
A file download that failed — or was cancelled — during this call.
-
type
final BrowserStateChange.Type type()
-
downloadId
final Optional<String> downloadId()
-
isTabOpened
final Boolean isTabOpened()
-
isDownloadStarted
final Boolean isDownloadStarted()
-
isDownloadCompleted
final Boolean isDownloadCompleted()
-
isDownloadFailed
final Boolean isDownloadFailed()
-
asTabOpened
final BrowserStateChangeTabOpened asTabOpened()
A tab this call's execution opened that remains open at its end — the creation delta of the
tabsinventory, not an event log.Carries only the
tab_id; the tab'stitleandurllive on itstabsentry, which must include the sametab_id. A tab opened during a failed call gets no deferredtab_opened; it simply appears in the next result'stabsinventory.
-
asDownloadStarted
final BrowserStateChangeDownloadStarted asDownloadStarted()
A file download that started during this call.
-
asDownloadCompleted
final BrowserStateChangeDownloadCompleted asDownloadCompleted()
A file download that finished during this call, reported with the same
download_idas itsdownload_started— or without a priordownload_started, when the download finished during the call that started it (at most one state change perdownload_idper result).
-
asDownloadFailed
final BrowserStateChangeDownloadFailed asDownloadFailed()
A file download that failed — or was cancelled — during this call.
-
accept
final <T extends Any> T accept(BrowserStateChange.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 = browserStateChange.accept(new BrowserStateChange.Visitor<Optional<String>>() { @Override public Optional<String> visitTabOpened(BrowserStateChangeTabOpened tabOpened) { return Optional.of(tabOpened.toString()); } // ... @Override public Optional<String> unknown(JsonValue json) { // Or inspect the `json`. return Optional.empty(); } });
-
validate
final BrowserStateChange 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.
-
ofTabOpened
final static BrowserStateChange ofTabOpened(BrowserStateChangeTabOpened tabOpened)
A tab this call's execution opened that remains open at its end — the creation delta of the
tabsinventory, not an event log.Carries only the
tab_id; the tab'stitleandurllive on itstabsentry, which must include the sametab_id. A tab opened during a failed call gets no deferredtab_opened; it simply appears in the next result'stabsinventory.
-
ofTabOpened
final static BrowserStateChange ofTabOpened(String tabId)
Returns an immutable instance of BrowserStateChange whose ofTabOpened variant is built from the given required tabId.
-
ofDownloadStarted
final static BrowserStateChange ofDownloadStarted(BrowserStateChangeDownloadStarted downloadStarted)
A file download that started during this call.
-
ofDownloadCompleted
final static BrowserStateChange ofDownloadCompleted(BrowserStateChangeDownloadCompleted downloadCompleted)
A file download that finished during this call, reported with the same
download_idas itsdownload_started— or without a priordownload_started, when the download finished during the call that started it (at most one state change perdownload_idper result).
-
ofDownloadFailed
final static BrowserStateChange ofDownloadFailed(BrowserStateChangeDownloadFailed downloadFailed)
A file download that failed — or was cancelled — during this call.
-
-
-
-