Package com.xero.api
Class ApiClient
- java.lang.Object
-
- com.xero.api.ApiClient
-
public class ApiClient extends Object
ApiClient for managing global http client and object mapper
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classApiClient.JacksonJsonHttpContentmethod for managing objects to be serialized
-
Constructor Summary
Constructors Constructor Description ApiClient()method for initiazing object instance with default propertiesApiClient(String basePath, com.google.api.client.http.HttpTransport transport, com.google.api.client.http.HttpRequestInitializer initializer, com.fasterxml.jackson.databind.ObjectMapper objectMapper, com.google.api.client.http.HttpRequestFactory reqFactory)ApiClient method for initiazing object instance with custom properties
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AccountingApiaccountingApi()Builder pattern to get API instances for this client.StringgetBasePath()method for retrieving the basePath propertyintgetConnectionTimeout()method for retrieving the connectionTimeout propertycom.google.api.client.http.HttpRequestFactorygetHttpRequestFactory()method for retrieving the httpRequestFactory propertycom.google.api.client.http.HttpTransportgetHttpTransport()method for retrieving the httpTransport propertycom.fasterxml.jackson.databind.ObjectMappergetObjectMapper()method for retrieving the objectMapper propertyintgetReadTimeout()method for retrieving the readTimeout propertycom.google.api.client.http.HttpResponserevoke(String clientId, String clientSecret, String refreshToken)method for revoking a refresh tokenvoidsetConnectionTimeout(int connectionTimeout)method for setting the connectionTimeout propertyvoidsetHttpTransport(com.google.api.client.http.HttpTransport transport)method for setting the httpTransport propertyvoidsetReadTimeout(int readTimeout)method for setting the readTimeout propertycom.auth0.jwt.interfaces.DecodedJWTverify(String accessToken)method for verifying an access token using RSA256 Algorithm
-
-
-
Constructor Detail
-
ApiClient
public ApiClient()
method for initiazing object instance with default properties
-
ApiClient
public ApiClient(String basePath, com.google.api.client.http.HttpTransport transport, com.google.api.client.http.HttpRequestInitializer initializer, com.fasterxml.jackson.databind.ObjectMapper objectMapper, com.google.api.client.http.HttpRequestFactory reqFactory)
ApiClient method for initiazing object instance with custom properties- Parameters:
basePath- String that defines the base path for each API requesttransport- HttpTransport required for creating the httpRequestFactoryinitializer- HttpRequestInitializer for additional configuration during creation of httpRequestFactoryobjectMapper- ObjectMapper object used to serialize and deserialize using model classes.reqFactory- HttpRequestFactory is the thread-safe light-weight HTTP request factory layer on top of the HTTP transport
-
-
Method Detail
-
getHttpRequestFactory
public com.google.api.client.http.HttpRequestFactory getHttpRequestFactory()
method for retrieving the httpRequestFactory property- Returns:
- HttpRequestFactory
-
getConnectionTimeout
public int getConnectionTimeout()
method for retrieving the connectionTimeout property- Returns:
- int
-
setConnectionTimeout
public void setConnectionTimeout(int connectionTimeout)
method for setting the connectionTimeout property- Parameters:
connectionTimeout- int defines in milliseconds the time allowed making the initial connection to the server.
-
getReadTimeout
public int getReadTimeout()
method for retrieving the readTimeout property- Returns:
- int
-
setReadTimeout
public void setReadTimeout(int readTimeout)
method for setting the readTimeout property- Parameters:
readTimeout- int defines in milliseconds the time allowed to complete reading data from the server.
-
getHttpTransport
public com.google.api.client.http.HttpTransport getHttpTransport()
method for retrieving the httpTransport property- Returns:
- HttpTransport
-
setHttpTransport
public void setHttpTransport(com.google.api.client.http.HttpTransport transport)
method for setting the httpTransport property- Parameters:
transport- HttpTransport required for creating the httpRequestFactory
-
getBasePath
public String getBasePath()
method for retrieving the basePath property- Returns:
- String
-
getObjectMapper
public com.fasterxml.jackson.databind.ObjectMapper getObjectMapper()
method for retrieving the objectMapper property- Returns:
- ObjectMapper
-
accountingApi
public AccountingApi accountingApi()
Builder pattern to get API instances for this client.- Returns:
- AccountingApi
-
verify
public com.auth0.jwt.interfaces.DecodedJWT verify(String accessToken) throws MalformedURLException, com.auth0.jwk.JwkException
method for verifying an access token using RSA256 Algorithm- Parameters:
accessToken- String the JWT token used to access the API- Returns:
- DecodedJWT
- Throws:
MalformedURLException- Thrown to indicate that a malformed URL has occurred.com.auth0.jwk.JwkException- thrown to indicate a problem while verifying a JWT
-
revoke
public com.google.api.client.http.HttpResponse revoke(String clientId, String clientSecret, String refreshToken) throws IOException
method for revoking a refresh token- Parameters:
refreshToken- String the refresh token used to obtain a new access token via the APIclientId- String the client id used to authtenticate with the APIclientSecret- String the client secret used to authtenticate with the API- Returns:
- revokeResponse HttpResponse a successful revocation request will return a 200 response with an empty body.
- Throws:
IOException
-
-