Class ApiTokensImpl

java.lang.Object
io.mailtrap.api.apiresource.ApiResource
io.mailtrap.api.apitokens.ApiTokensImpl
All Implemented Interfaces:
ApiTokens

public class ApiTokensImpl extends ApiResource implements ApiTokens
  • Constructor Details

  • Method Details

    • getAllApiTokens

      public List<ApiToken> getAllApiTokens(long accountId)
      Description copied from interface: ApiTokens
      List all API tokens visible to the current API token.
      Specified by:
      getAllApiTokens in interface ApiTokens
      Parameters:
      accountId - unique account ID
      Returns:
      list of API tokens
    • createApiToken

      public ApiTokenWithToken createApiToken(long accountId, CreateApiTokenRequest request)
      Description copied from interface: ApiTokens
      Create a new API token for the account with the given name and resource permissions. The full token value is returned only on creation.
      Specified by:
      createApiToken in interface ApiTokens
      Parameters:
      accountId - unique account ID
      request - token name and resource permissions
      Returns:
      created token, including the full token value
    • getApiToken

      public ApiToken getApiToken(long accountId, long id)
      Description copied from interface: ApiTokens
      Get a single API token by id.
      Specified by:
      getApiToken in interface ApiTokens
      Parameters:
      accountId - unique account ID
      id - API token ID
      Returns:
      API token
    • deleteApiToken

      public void deleteApiToken(long accountId, long id)
      Description copied from interface: ApiTokens
      Permanently delete an API token.
      Specified by:
      deleteApiToken in interface ApiTokens
      Parameters:
      accountId - unique account ID
      id - API token ID
    • resetApiToken

      public ApiTokenWithToken resetApiToken(long accountId, long id)
      Description copied from interface: ApiTokens
      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.
      Specified by:
      resetApiToken in interface ApiTokens
      Parameters:
      accountId - unique account ID
      id - API token ID
      Returns:
      new token, including the full token value