Package com.xero.api
Class ApiClient
java.lang.Object
com.xero.api.ApiClient
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassmethod for managing objects to be serialized -
Constructor Summary
ConstructorsConstructorDescriptionmethod 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
Modifier and TypeMethodDescriptionBuilder pattern to get API instances for this client.method for retrieving the basePath propertyintmethod for retrieving the connectionTimeout propertycom.google.api.client.http.HttpRequestFactorymethod for retrieving the httpRequestFactory propertycom.google.api.client.http.HttpTransportmethod for retrieving the httpTransport propertycom.fasterxml.jackson.databind.ObjectMappermethod for retrieving the objectMapper propertyintmethod for retrieving the readTimeout propertycom.google.api.client.http.HttpResponsemethod 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.DecodedJWTmethod for verifying an access token using RSA256 Algorithm
-
Constructor Details
-
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 Details
-
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
-
getObjectMapper
public com.fasterxml.jackson.databind.ObjectMapper getObjectMapper()method for retrieving the objectMapper property- Returns:
- ObjectMapper
-
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:
clientId- String the client id used to authtenticate with the APIclientSecret- String the client secret used to authtenticate with the APIrefreshToken- String the refresh token used to obtain a new access token via the API- Returns:
- revokeResponse HttpResponse a successful revocation request will return a 200 response with an empty body.
- Throws:
IOException
-