code: public DefaultOAuth2AccessToken retrieveToken(String grantType, String accept, String authorization, String clientId, String password, String refreshToken, String scope, String username) throws ApiException {
          ApiResponse<DefaultOAuth2AccessToken> resp = retrieveTokenWithHttpInfo(grantType, accept, authorization, clientId, password, refreshToken, scope, username);
          return resp.getData();
      }
docs: Retrieve access token
  Retrieve an access token based on the grant type &amp;mdash; Authorization Code Grant, Resource Owner Password Credentials Grant or Client Credentials Grant. For more information, see [Token Endpoint](https://tools.ietf.org/html/rfc6749). **Note:** For the optional **scope** parameter, the Authentication API supports only the &#x60;*&#x60; value.
  @param grantType The grant type you use to implement authentication. (required)
  @param accept The media type the Authentication API should should use for the response. For example: &#39;Accept: application/x-www-form-urlencoded&#39; (optional)
  @param authorization Basic authorization. For example: &#39;Authorization: Basic Y3...MQ&#x3D;&#x3D;&#39; (optional)
  @param clientId The ID of the application or service that is registered as the client. You&#39;ll need to get this value from your PureEngage Cloud representative. (optional)
  @param password The agent&#39;s password. (optional)
  @param refreshToken See [Refresh Token](https://tools.ietf.org/html/rfc6749#section-1.5) for details. (optional)
  @param scope The scope of the access request. The Authentication API supports only the &#x60;*&#x60; value. (optional)
  @param username The agent&#39;s username. (optional)
  @return DefaultOAuth2AccessToken
  @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body