Class SessionCreateParams.Resource
-
- All Implemented Interfaces:
public final class SessionCreateParams.ResourceUnion of resources that can be mounted into a session.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceSessionCreateParams.Resource.VisitorAn interface that defines how to map each variant of Resource to a value of type T.
public final classSessionCreateParams.Resource.Type
-
Method Summary
Modifier and Type Method Description final Optional<BetaManagedAgentsGitHubRepositoryResourceParams>githubRepository()Mount a GitHub repository into the session's container. final Optional<BetaManagedAgentsFileResourceParams>file()Mount a file uploaded via the Files API into the session. final Optional<BetaManagedAgentsMemoryStoreResourceParam>memoryStore()Parameters for attaching a memory store to an agent session. final Optional<JsonValue>_json()final SessionCreateParams.Resource.Typetype()final Optional<String>mountPath()final BooleanisGitHubRepository()final BooleanisFile()final BooleanisMemoryStore()final BetaManagedAgentsGitHubRepositoryResourceParamsasGitHubRepository()Mount a GitHub repository into the session's container. final BetaManagedAgentsFileResourceParamsasFile()Mount a file uploaded via the Files API into the session. final BetaManagedAgentsMemoryStoreResourceParamasMemoryStore()Parameters for attaching a memory store to an agent session. final <T extends Any> Taccept(SessionCreateParams.Resource.Visitor<T> visitor)Maps this instance's current variant to a value of type T using the given visitor. final SessionCreateParams.Resourcevalidate()Validates that the types of all values in this object match their expected types recursively. final BooleanisValid()Booleanequals(Object other)IntegerhashCode()StringtoString()final static SessionCreateParams.ResourceofGitHubRepository(BetaManagedAgentsGitHubRepositoryResourceParams githubRepository)Mount a GitHub repository into the session's container. final static SessionCreateParams.ResourceofGitHubRepository(String url)Returns an immutable instance of Resource whose ofGitHubRepository variant is built from the given required url. final static SessionCreateParams.ResourceofFile(BetaManagedAgentsFileResourceParams file)Mount a file uploaded via the Files API into the session. final static SessionCreateParams.ResourceofFile(String fileId)Returns an immutable instance of Resource whose ofFile variant is built from the given required fileId. final static SessionCreateParams.ResourceofMemoryStore(BetaManagedAgentsMemoryStoreResourceParam memoryStore)Parameters for attaching a memory store to an agent session. final static SessionCreateParams.ResourceofMemoryStore(String memoryStoreId)Returns an immutable instance of Resource whose ofMemoryStore variant is built from the given required memoryStoreId. -
-
Method Detail
-
githubRepository
final Optional<BetaManagedAgentsGitHubRepositoryResourceParams> githubRepository()
Mount a GitHub repository into the session's container.
-
file
final Optional<BetaManagedAgentsFileResourceParams> file()
Mount a file uploaded via the Files API into the session.
-
memoryStore
final Optional<BetaManagedAgentsMemoryStoreResourceParam> memoryStore()
Parameters for attaching a memory store to an agent session.
-
type
final SessionCreateParams.Resource.Type type()
-
isGitHubRepository
final Boolean isGitHubRepository()
-
isMemoryStore
final Boolean isMemoryStore()
-
asGitHubRepository
final BetaManagedAgentsGitHubRepositoryResourceParams asGitHubRepository()
Mount a GitHub repository into the session's container.
-
asFile
final BetaManagedAgentsFileResourceParams asFile()
Mount a file uploaded via the Files API into the session.
-
asMemoryStore
final BetaManagedAgentsMemoryStoreResourceParam asMemoryStore()
Parameters for attaching a memory store to an agent session.
-
accept
final <T extends Any> T accept(SessionCreateParams.Resource.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 = resource.accept(new Resource.Visitor<Optional<String>>() { @Override public Optional<String> visitGitHubRepository(BetaManagedAgentsGitHubRepositoryResourceParams githubRepository) { return Optional.of(githubRepository.toString()); } // ... @Override public Optional<String> unknown(JsonValue json) { // Or inspect the `json`. return Optional.empty(); } });
-
validate
final SessionCreateParams.Resource 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.
-
ofGitHubRepository
final static SessionCreateParams.Resource ofGitHubRepository(BetaManagedAgentsGitHubRepositoryResourceParams githubRepository)
Mount a GitHub repository into the session's container.
-
ofGitHubRepository
final static SessionCreateParams.Resource ofGitHubRepository(String url)
Returns an immutable instance of Resource whose ofGitHubRepository variant is built from the given required url.
-
ofFile
final static SessionCreateParams.Resource ofFile(BetaManagedAgentsFileResourceParams file)
Mount a file uploaded via the Files API into the session.
-
ofFile
final static SessionCreateParams.Resource ofFile(String fileId)
Returns an immutable instance of Resource whose ofFile variant is built from the given required fileId.
-
ofMemoryStore
final static SessionCreateParams.Resource ofMemoryStore(BetaManagedAgentsMemoryStoreResourceParam memoryStore)
Parameters for attaching a memory store to an agent session.
-
ofMemoryStore
final static SessionCreateParams.Resource ofMemoryStore(String memoryStoreId)
Returns an immutable instance of Resource whose ofMemoryStore variant is built from the given required memoryStoreId.
-
-
-
-