Package com.contentful.java.cma.model
Class CMAPersonalAccessToken
- java.lang.Object
-
- com.contentful.java.cma.model.CMAResource
-
- com.contentful.java.cma.model.CMAPersonalAccessToken
-
public class CMAPersonalAccessToken extends CMAResource
Model storing the information about a personal access token.Once a personal access token is created, it's token field will be returned only once: directly as a result of the create call.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classCMAPersonalAccessToken.ScopeEnum holding the allowed values of scope.
-
Constructor Summary
Constructors Constructor Description CMAPersonalAccessToken()Create a new personal access token to be uploaded to Contentful.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CMAPersonalAccessTokenaddScope(CMAPersonalAccessToken.Scope scope)Add a new scope to the list of scopes.java.lang.StringgetName()java.lang.StringgetRevokedAt()java.util.List<CMAPersonalAccessToken.Scope>getScopes()java.lang.StringgetToken()This getter returns the token string of this token.CMAPersonalAccessTokensetName(java.lang.String name)Sets the name for this personal access token.CMAPersonalAccessTokensetSystem(CMASystem system)Sets the system field.java.lang.StringtoString()-
Methods inherited from class com.contentful.java.cma.model.CMAResource
getEnvironmentId, getId, getSpaceId, getSystem, getVersion, getVisibility, isArchived, isPublished, setEnvironmentId, setId, setSpaceId, setVersion, setVisibility
-
-
-
-
Method Detail
-
setSystem
public CMAPersonalAccessToken setSystem(CMASystem system)
Sets the system field.- Overrides:
setSystemin classCMAResource- Parameters:
system- sets the system property.- Returns:
- this, as casted to a resource, for the ease of chaining.
-
getName
public java.lang.String getName()
- Returns:
- the name of this personal access token.
-
setName
public CMAPersonalAccessToken setName(java.lang.String name)
Sets the name for this personal access token.- Parameters:
name- the name of the personal access token to be set.- Returns:
- this
CMAPersonalAccessTokeninstance.
-
getRevokedAt
public java.lang.String getRevokedAt()
- Returns:
- the time this token was revoked, or null if it is still active.
- See Also:
ModulePersonalAccessTokens.revoke(CMAPersonalAccessToken)
-
addScope
public CMAPersonalAccessToken addScope(CMAPersonalAccessToken.Scope scope)
Add a new scope to the list of scopes. Creates a new list of scopes if no scopes found.- Parameters:
scope- the new scope to be added.- Returns:
- this instance for chaining.
-
getScopes
public java.util.List<CMAPersonalAccessToken.Scope> getScopes()
- Returns:
- all added scopes or null if no scopes where added.
-
getToken
public java.lang.String getToken()
This getter returns the token string of this token.This string is to be used instead of the CMA token used to create it. Sadly it is only available directly after the token got created, as a response to the create call. Subsequent calls of fetching it by id, or as a collection request, will not return it, so please save it securely after creation.
- Returns:
- the token string if just created or null.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classCMAResource- Returns:
- a human readable string, representing the object.
-
-