Class 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.

    • Constructor Detail

      • CMAPersonalAccessToken

        public CMAPersonalAccessToken()
        Create a new personal access token to be uploaded to Contentful.
    • Method Detail

      • setSystem

        public CMAPersonalAccessToken setSystem​(CMASystem system)
        Sets the system field.
        Overrides:
        setSystem in class CMAResource
        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 CMAPersonalAccessToken instance.
      • 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.
      • 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:
        toString in class CMAResource
        Returns:
        a human readable string, representing the object.