Class BetaPlugin.Owner
-
- All Implemented Interfaces:
public final class BetaPlugin.OwnerWho owns the Plugin: the organization, or the member whose personal plugin marketplace it lives in.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceBetaPlugin.Owner.VisitorAn interface that defines how to map each variant of Owner to a value of type T.
public final classBetaPlugin.Owner.Type
-
Method Summary
Modifier and Type Method Description final Optional<BetaPluginOwnerOrganization>organization()final Optional<BetaPluginOwnerUser>user()final Optional<JsonValue>_json()final BetaPlugin.Owner.Typetype()final BooleanisOrganization()final BooleanisUser()final BetaPluginOwnerOrganizationasOrganization()final BetaPluginOwnerUserasUser()final <T extends Any> Taccept(BetaPlugin.Owner.Visitor<T> visitor)Maps this instance's current variant to a value of type T using the given visitor. final BetaPlugin.Ownervalidate()Validates that the types of all values in this object match their expected types recursively. final BooleanisValid()Booleanequals(Object other)IntegerhashCode()StringtoString()final static BetaPlugin.OwnerofOrganization(BetaPluginOwnerOrganization organization)final static BetaPlugin.OwnerofUser(BetaPluginOwnerUser user)final static BetaPlugin.OwnerofUser(String userId)Returns an immutable instance of Owner whose ofUser variant is built from the given required userId. -
-
Method Detail
-
organization
final Optional<BetaPluginOwnerOrganization> organization()
-
user
final Optional<BetaPluginOwnerUser> user()
-
type
final BetaPlugin.Owner.Type type()
-
isOrganization
final Boolean isOrganization()
-
asOrganization
final BetaPluginOwnerOrganization asOrganization()
-
asUser
final BetaPluginOwnerUser asUser()
-
accept
final <T extends Any> T accept(BetaPlugin.Owner.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 = owner.accept(new Owner.Visitor<Optional<String>>() { @Override public Optional<String> visitOrganization(BetaPluginOwnerOrganization organization) { return Optional.of(organization.toString()); } // ... @Override public Optional<String> unknown(JsonValue json) { // Or inspect the `json`. return Optional.empty(); } });
-
validate
final BetaPlugin.Owner 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.
-
ofOrganization
final static BetaPlugin.Owner ofOrganization(BetaPluginOwnerOrganization organization)
-
ofUser
final static BetaPlugin.Owner ofUser(BetaPluginOwnerUser user)
-
-
-
-