Class SpendSummary.Actor
-
- All Implemented Interfaces:
public final class SpendSummary.Actor
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceSpendSummary.Actor.VisitorAn interface that defines how to map each variant of Actor to a value of type T.
public final classSpendSummary.Actor.Type
-
Method Summary
Modifier and Type Method Description final Optional<SpendLimitUserActor>user()A user within the organization. final Optional<SpendLimitScopedApiKeyActor>scopedApiKey()A scoped Admin API key acting on behalf of the organization. final Optional<JsonValue>_json()final SpendSummary.Actor.Typetype()final BooleanisUser()final BooleanisScopedApiKey()final SpendLimitUserActorasUser()A user within the organization. final SpendLimitScopedApiKeyActorasScopedApiKey()A scoped Admin API key acting on behalf of the organization. final <T extends Any> Taccept(SpendSummary.Actor.Visitor<T> visitor)Maps this instance's current variant to a value of type T using the given visitor. final SpendSummary.Actorvalidate()Validates that the types of all values in this object match their expected types recursively. final BooleanisValid()Booleanequals(Object other)IntegerhashCode()StringtoString()final static SpendSummary.ActorofUser(SpendLimitUserActor user)A user within the organization. final static SpendSummary.ActorofScopedApiKey(SpendLimitScopedApiKeyActor scopedApiKey)A scoped Admin API key acting on behalf of the organization. final static SpendSummary.ActorofScopedApiKey(String scopedApiKeyId)Returns an immutable instance of Actor whose ofScopedApiKey variant is built from the given required scopedApiKeyId. -
-
Method Detail
-
user
final Optional<SpendLimitUserActor> user()
A user within the organization.
nameandemail_addressare null when the underlying account is unavailable or has been deleted;deletedis true only for deleted accounts.
-
scopedApiKey
final Optional<SpendLimitScopedApiKeyActor> scopedApiKey()
A scoped Admin API key acting on behalf of the organization.
-
type
final SpendSummary.Actor.Type type()
-
isScopedApiKey
final Boolean isScopedApiKey()
-
asUser
final SpendLimitUserActor asUser()
A user within the organization.
nameandemail_addressare null when the underlying account is unavailable or has been deleted;deletedis true only for deleted accounts.
-
asScopedApiKey
final SpendLimitScopedApiKeyActor asScopedApiKey()
A scoped Admin API key acting on behalf of the organization.
-
accept
final <T extends Any> T accept(SpendSummary.Actor.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 = actor.accept(new Actor.Visitor<Optional<String>>() { @Override public Optional<String> visitUser(SpendLimitUserActor user) { return Optional.of(user.toString()); } // ... @Override public Optional<String> unknown(JsonValue json) { // Or inspect the `json`. return Optional.empty(); } });
-
validate
final SpendSummary.Actor 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.
-
ofUser
final static SpendSummary.Actor ofUser(SpendLimitUserActor user)
A user within the organization.
nameandemail_addressare null when the underlying account is unavailable or has been deleted;deletedis true only for deleted accounts.
-
ofScopedApiKey
final static SpendSummary.Actor ofScopedApiKey(SpendLimitScopedApiKeyActor scopedApiKey)
A scoped Admin API key acting on behalf of the organization.
-
ofScopedApiKey
final static SpendSummary.Actor ofScopedApiKey(String scopedApiKeyId)
Returns an immutable instance of Actor whose ofScopedApiKey variant is built from the given required scopedApiKeyId.
-
-
-
-