Interface ApiTokens

All Known Implementing Classes:
ApiTokensImpl

public interface ApiTokens
  • Method Details

    • getAllApiTokens

      List<ApiToken> getAllApiTokens(long accountId)
      List all API tokens visible to the current API token.
      Parameters:
      accountId - unique account ID
      Returns:
      list of API tokens
    • createApiToken

      ApiTokenWithToken createApiToken(long accountId, CreateApiTokenRequest request)
      Create a new API token for the account with the given name and resource permissions. The full token value is returned only on creation. Without an explicit expiration in the request the server assigns its default lifetime (currently 1 year); use TokenExpiration.never() for a token that never expires.
      Parameters:
      accountId - unique account ID
      request - token name and resource permissions
      Returns:
      created token, including the full token value
    • getApiToken

      ApiToken getApiToken(long accountId, long id)
      Get a single API token by id.
      Parameters:
      accountId - unique account ID
      id - API token ID
      Returns:
      API token
    • deleteApiToken

      void deleteApiToken(long accountId, long id)
      Permanently delete an API token.
      Parameters:
      accountId - unique account ID
      id - API token ID
    • resetApiToken

      ApiTokenWithToken resetApiToken(long accountId, long id)
      Reset an API token. Expires the requested token and creates a new one with the same permissions; the new token value is returned only once. The new token gets the server default lifetime (currently 1 year); use resetApiToken(long, long, ResetApiTokenRequest) to set the expiration explicitly, including a token that never expires.
      Parameters:
      accountId - unique account ID
      id - API token ID
      Returns:
      new token, including the full token value
    • resetApiToken

      ApiTokenWithToken resetApiToken(long accountId, long id, ResetApiTokenRequest request)
      Reset an API token. Expires the requested token and creates a new one with the same permissions; the new token value is returned only once. The request can set the new token expiration; omit it for the server default.
      Parameters:
      accountId - unique account ID
      id - API token ID
      request - optional new token expiration
      Returns:
      new token, including the full token value