
com.xero.api.client.PayrollNzApi Maven / Gradle / Ivy
/*
* Xero Payroll NZ
* This is the Xero Payroll API for orgs in the NZ region.
*
* The version of the OpenAPI document: 6.3.0
* Contact: [email protected]
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
package com.xero.api.client;
import com.fasterxml.jackson.core.type.TypeReference;
import com.google.api.client.auth.oauth2.BearerToken;
import com.google.api.client.auth.oauth2.Credential;
import com.google.api.client.http.GenericUrl;
import com.google.api.client.http.HttpContent;
import com.google.api.client.http.HttpHeaders;
import com.google.api.client.http.HttpMethods;
import com.google.api.client.http.HttpRequestFactory;
import com.google.api.client.http.HttpResponse;
import com.google.api.client.http.HttpResponseException;
import com.google.api.client.http.HttpTransport;
import com.xero.api.ApiClient;
import com.xero.api.XeroApiExceptionHandler;
import com.xero.models.payrollnz.Benefit;
import com.xero.models.payrollnz.Deduction;
import com.xero.models.payrollnz.DeductionObject;
import com.xero.models.payrollnz.Deductions;
import com.xero.models.payrollnz.EarningsRate;
import com.xero.models.payrollnz.EarningsRateObject;
import com.xero.models.payrollnz.EarningsRates;
import com.xero.models.payrollnz.EarningsTemplate;
import com.xero.models.payrollnz.EarningsTemplateObject;
import com.xero.models.payrollnz.Employee;
import com.xero.models.payrollnz.EmployeeEarningsTemplates;
import com.xero.models.payrollnz.EmployeeLeave;
import com.xero.models.payrollnz.EmployeeLeaveBalances;
import com.xero.models.payrollnz.EmployeeLeaveObject;
import com.xero.models.payrollnz.EmployeeLeaveSetup;
import com.xero.models.payrollnz.EmployeeLeaveSetupObject;
import com.xero.models.payrollnz.EmployeeLeaveType;
import com.xero.models.payrollnz.EmployeeLeaveTypeObject;
import com.xero.models.payrollnz.EmployeeLeaveTypes;
import com.xero.models.payrollnz.EmployeeLeaves;
import com.xero.models.payrollnz.EmployeeObject;
import com.xero.models.payrollnz.EmployeeOpeningBalance;
import com.xero.models.payrollnz.EmployeeOpeningBalancesObject;
import com.xero.models.payrollnz.EmployeePayTemplates;
import com.xero.models.payrollnz.EmployeeTax;
import com.xero.models.payrollnz.EmployeeTaxObject;
import com.xero.models.payrollnz.EmployeeWorkingPatternWithWorkingWeeksObject;
import com.xero.models.payrollnz.EmployeeWorkingPatternWithWorkingWeeksRequest;
import com.xero.models.payrollnz.EmployeeWorkingPatternsObject;
import com.xero.models.payrollnz.Employees;
import com.xero.models.payrollnz.Employment;
import com.xero.models.payrollnz.EmploymentObject;
import com.xero.models.payrollnz.LeavePeriods;
import com.xero.models.payrollnz.LeaveType;
import com.xero.models.payrollnz.LeaveTypeObject;
import com.xero.models.payrollnz.LeaveTypes;
import com.xero.models.payrollnz.PayRun;
import com.xero.models.payrollnz.PayRunCalendar;
import com.xero.models.payrollnz.PayRunCalendarObject;
import com.xero.models.payrollnz.PayRunCalendars;
import com.xero.models.payrollnz.PayRunObject;
import com.xero.models.payrollnz.PayRuns;
import com.xero.models.payrollnz.PaySlip;
import com.xero.models.payrollnz.PaySlipObject;
import com.xero.models.payrollnz.PaySlips;
import com.xero.models.payrollnz.PaymentMethod;
import com.xero.models.payrollnz.PaymentMethodObject;
import com.xero.models.payrollnz.Reimbursement;
import com.xero.models.payrollnz.ReimbursementObject;
import com.xero.models.payrollnz.Reimbursements;
import com.xero.models.payrollnz.SalaryAndWage;
import com.xero.models.payrollnz.SalaryAndWageObject;
import com.xero.models.payrollnz.SalaryAndWages;
import com.xero.models.payrollnz.Settings;
import com.xero.models.payrollnz.StatutoryDeductionObject;
import com.xero.models.payrollnz.StatutoryDeductions;
import com.xero.models.payrollnz.SuperannuationObject;
import com.xero.models.payrollnz.Superannuations;
import com.xero.models.payrollnz.Timesheet;
import com.xero.models.payrollnz.TimesheetLine;
import com.xero.models.payrollnz.TimesheetLineObject;
import com.xero.models.payrollnz.TimesheetObject;
import com.xero.models.payrollnz.Timesheets;
import com.xero.models.payrollnz.TrackingCategories;
import jakarta.ws.rs.core.UriBuilder;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import org.apache.commons.io.IOUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.threeten.bp.LocalDate;
/** PayrollNzApi has methods for interacting with all endpoints in the API set */
public class PayrollNzApi {
private ApiClient apiClient;
private static PayrollNzApi instance = null;
private String userAgent = "Default";
private String version = "8.3.0";
static final Logger logger = LoggerFactory.getLogger(PayrollNzApi.class);
/** PayrollNzApi */
public PayrollNzApi() {
this(new ApiClient());
}
/**
* PayrollNzApi getInstance
*
* @param apiClient ApiClient pass into the new instance of this class
* @return instance of this class
*/
public static PayrollNzApi getInstance(ApiClient apiClient) {
if (instance == null) {
instance = new PayrollNzApi(apiClient);
}
return instance;
}
/**
* PayrollNzApi
*
* @param apiClient ApiClient pass into the new instance of this class
*/
public PayrollNzApi(ApiClient apiClient) {
this.apiClient = apiClient;
}
/**
* get ApiClient
*
* @return apiClient the current ApiClient
*/
public ApiClient getApiClient() {
return apiClient;
}
/**
* set ApiClient
*
* @param apiClient ApiClient pass into the new instance of this class
*/
public void setApiClient(ApiClient apiClient) {
this.apiClient = apiClient;
}
/**
* set user agent
*
* @param userAgent string to override the user agent
*/
public void setUserAgent(String userAgent) {
this.userAgent = userAgent;
}
/**
* get user agent
*
* @return String of user agent
*/
public String getUserAgent() {
return this.userAgent + " [Xero-Java-" + this.version + "]";
}
/**
* Approves a timesheet
*
* 200 - search results matching criteria
*
*
400 - validation error for a bad request
*
* @param xeroTenantId Xero identifier for Tenant
* @param timesheetID Identifier for the timesheet
* @param idempotencyKey This allows you to safely retry requests without the risk of duplicate
* processing. 128 character max.
* @param accessToken Authorization token for user set in header of each request
* @return TimesheetObject
* @throws IOException if an error occurs while attempting to invoke the API *
*/
public TimesheetObject approveTimesheet(
String accessToken, String xeroTenantId, UUID timesheetID, String idempotencyKey)
throws IOException {
try {
TypeReference typeRef = new TypeReference() {};
HttpResponse response =
approveTimesheetForHttpResponse(accessToken, xeroTenantId, timesheetID, idempotencyKey);
return apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
} catch (HttpResponseException e) {
if (logger.isDebugEnabled()) {
logger.debug(
"------------------ HttpResponseException "
+ e.getStatusCode()
+ " : approveTimesheet -------------------");
logger.debug(e.toString());
}
XeroApiExceptionHandler handler = new XeroApiExceptionHandler();
if (e.getStatusCode() == 400 || e.getStatusCode() == 405) {
TypeReference errorTypeRef = new TypeReference() {};
TimesheetObject object =
apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef);
handler.validationError(e.getStatusCode(), "TimesheetObject", object.getProblem(), e);
} else {
handler.execute(e);
}
} catch (IOException ioe) {
throw ioe;
}
return null;
}
/**
* Approves a timesheet
*
* 200 - search results matching criteria
*
*
400 - validation error for a bad request
*
* @param xeroTenantId Xero identifier for Tenant
* @param timesheetID Identifier for the timesheet
* @param idempotencyKey This allows you to safely retry requests without the risk of duplicate
* processing. 128 character max.
* @param accessToken Authorization token for user set in header of each request
* @return HttpResponse
* @throws IOException if an error occurs while attempting to invoke the API
*/
public HttpResponse approveTimesheetForHttpResponse(
String accessToken, String xeroTenantId, UUID timesheetID, String idempotencyKey)
throws IOException {
// verify the required parameter 'xeroTenantId' is set
if (xeroTenantId == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'xeroTenantId' when calling approveTimesheet");
} // verify the required parameter 'timesheetID' is set
if (timesheetID == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'timesheetID' when calling approveTimesheet");
}
if (accessToken == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'accessToken' when calling approveTimesheet");
}
HttpHeaders headers = new HttpHeaders();
headers.set("Xero-Tenant-Id", xeroTenantId);
headers.set("Idempotency-Key", idempotencyKey);
headers.setAccept("application/json");
headers.setUserAgent(this.getUserAgent());
// create a map of path variables
final Map uriVariables = new HashMap();
uriVariables.put("TimesheetID", timesheetID);
UriBuilder uriBuilder =
UriBuilder.fromUri(apiClient.getBasePath() + "/Timesheets/{TimesheetID}/Approve");
String url = uriBuilder.buildFromMap(uriVariables).toString();
GenericUrl genericUrl = new GenericUrl(url);
if (logger.isDebugEnabled()) {
logger.debug("POST " + genericUrl.toString());
}
HttpContent content = null;
Credential credential =
new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken);
HttpTransport transport = apiClient.getHttpTransport();
HttpRequestFactory requestFactory = transport.createRequestFactory(credential);
return requestFactory
.buildRequest(HttpMethods.POST, genericUrl, content)
.setHeaders(headers)
.setConnectTimeout(apiClient.getConnectionTimeout())
.setReadTimeout(apiClient.getReadTimeout())
.execute();
}
/**
* Creates a new deduction for a specific employee
*
* 200 - search results matching criteria
*
*
400 - validation error for a bad request
*
* @param xeroTenantId Xero identifier for Tenant
* @param deduction The deduction parameter
* @param idempotencyKey This allows you to safely retry requests without the risk of duplicate
* processing. 128 character max.
* @param accessToken Authorization token for user set in header of each request
* @return DeductionObject
* @throws IOException if an error occurs while attempting to invoke the API *
*/
public DeductionObject createDeduction(
String accessToken, String xeroTenantId, Deduction deduction, String idempotencyKey)
throws IOException {
try {
TypeReference typeRef = new TypeReference() {};
HttpResponse response =
createDeductionForHttpResponse(accessToken, xeroTenantId, deduction, idempotencyKey);
return apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
} catch (HttpResponseException e) {
if (logger.isDebugEnabled()) {
logger.debug(
"------------------ HttpResponseException "
+ e.getStatusCode()
+ " : createDeduction -------------------");
logger.debug(e.toString());
}
XeroApiExceptionHandler handler = new XeroApiExceptionHandler();
if (e.getStatusCode() == 400 || e.getStatusCode() == 405) {
TypeReference errorTypeRef = new TypeReference() {};
DeductionObject object =
apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef);
handler.validationError(e.getStatusCode(), "DeductionObject", object.getProblem(), e);
} else {
handler.execute(e);
}
} catch (IOException ioe) {
throw ioe;
}
return null;
}
/**
* Creates a new deduction for a specific employee
*
* 200 - search results matching criteria
*
*
400 - validation error for a bad request
*
* @param xeroTenantId Xero identifier for Tenant
* @param deduction The deduction parameter
* @param idempotencyKey This allows you to safely retry requests without the risk of duplicate
* processing. 128 character max.
* @param accessToken Authorization token for user set in header of each request
* @return HttpResponse
* @throws IOException if an error occurs while attempting to invoke the API
*/
public HttpResponse createDeductionForHttpResponse(
String accessToken, String xeroTenantId, Deduction deduction, String idempotencyKey)
throws IOException {
// verify the required parameter 'xeroTenantId' is set
if (xeroTenantId == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'xeroTenantId' when calling createDeduction");
} // verify the required parameter 'deduction' is set
if (deduction == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'deduction' when calling createDeduction");
}
if (accessToken == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'accessToken' when calling createDeduction");
}
HttpHeaders headers = new HttpHeaders();
headers.set("Xero-Tenant-Id", xeroTenantId);
headers.set("Idempotency-Key", idempotencyKey);
headers.setAccept("application/json");
headers.setContentType("application/json");
headers.setUserAgent(this.getUserAgent());
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Deductions");
String url = uriBuilder.build().toString();
GenericUrl genericUrl = new GenericUrl(url);
if (logger.isDebugEnabled()) {
logger.debug("POST " + genericUrl.toString());
}
HttpContent content = null;
content = apiClient.new JacksonJsonHttpContent(deduction);
Credential credential =
new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken);
HttpTransport transport = apiClient.getHttpTransport();
HttpRequestFactory requestFactory = transport.createRequestFactory(credential);
return requestFactory
.buildRequest(HttpMethods.POST, genericUrl, content)
.setHeaders(headers)
.setConnectTimeout(apiClient.getConnectionTimeout())
.setReadTimeout(apiClient.getReadTimeout())
.execute();
}
/**
* Creates a new earnings rate
*
*
200 - search results matching criteria
*
*
400 - validation error for a bad request
*
* @param xeroTenantId Xero identifier for Tenant
* @param earningsRate The earningsRate parameter
* @param idempotencyKey This allows you to safely retry requests without the risk of duplicate
* processing. 128 character max.
* @param accessToken Authorization token for user set in header of each request
* @return EarningsRateObject
* @throws IOException if an error occurs while attempting to invoke the API *
*/
public EarningsRateObject createEarningsRate(
String accessToken, String xeroTenantId, EarningsRate earningsRate, String idempotencyKey)
throws IOException {
try {
TypeReference typeRef = new TypeReference() {};
HttpResponse response =
createEarningsRateForHttpResponse(
accessToken, xeroTenantId, earningsRate, idempotencyKey);
return apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
} catch (HttpResponseException e) {
if (logger.isDebugEnabled()) {
logger.debug(
"------------------ HttpResponseException "
+ e.getStatusCode()
+ " : createEarningsRate -------------------");
logger.debug(e.toString());
}
XeroApiExceptionHandler handler = new XeroApiExceptionHandler();
if (e.getStatusCode() == 400 || e.getStatusCode() == 405) {
TypeReference errorTypeRef = new TypeReference() {};
EarningsRateObject object =
apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef);
handler.validationError(e.getStatusCode(), "EarningsRateObject", object.getProblem(), e);
} else {
handler.execute(e);
}
} catch (IOException ioe) {
throw ioe;
}
return null;
}
/**
* Creates a new earnings rate
*
* 200 - search results matching criteria
*
*
400 - validation error for a bad request
*
* @param xeroTenantId Xero identifier for Tenant
* @param earningsRate The earningsRate parameter
* @param idempotencyKey This allows you to safely retry requests without the risk of duplicate
* processing. 128 character max.
* @param accessToken Authorization token for user set in header of each request
* @return HttpResponse
* @throws IOException if an error occurs while attempting to invoke the API
*/
public HttpResponse createEarningsRateForHttpResponse(
String accessToken, String xeroTenantId, EarningsRate earningsRate, String idempotencyKey)
throws IOException {
// verify the required parameter 'xeroTenantId' is set
if (xeroTenantId == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'xeroTenantId' when calling createEarningsRate");
} // verify the required parameter 'earningsRate' is set
if (earningsRate == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'earningsRate' when calling createEarningsRate");
}
if (accessToken == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'accessToken' when calling createEarningsRate");
}
HttpHeaders headers = new HttpHeaders();
headers.set("Xero-Tenant-Id", xeroTenantId);
headers.set("Idempotency-Key", idempotencyKey);
headers.setAccept("application/json");
headers.setContentType("application/json");
headers.setUserAgent(this.getUserAgent());
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/EarningsRates");
String url = uriBuilder.build().toString();
GenericUrl genericUrl = new GenericUrl(url);
if (logger.isDebugEnabled()) {
logger.debug("POST " + genericUrl.toString());
}
HttpContent content = null;
content = apiClient.new JacksonJsonHttpContent(earningsRate);
Credential credential =
new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken);
HttpTransport transport = apiClient.getHttpTransport();
HttpRequestFactory requestFactory = transport.createRequestFactory(credential);
return requestFactory
.buildRequest(HttpMethods.POST, genericUrl, content)
.setHeaders(headers)
.setConnectTimeout(apiClient.getConnectionTimeout())
.setReadTimeout(apiClient.getReadTimeout())
.execute();
}
/**
* Creates an employees
*
*
200 - search results matching criteria
*
*
400 - validation error for a bad request
*
* @param xeroTenantId Xero identifier for Tenant
* @param employee The employee parameter
* @param idempotencyKey This allows you to safely retry requests without the risk of duplicate
* processing. 128 character max.
* @param accessToken Authorization token for user set in header of each request
* @return EmployeeObject
* @throws IOException if an error occurs while attempting to invoke the API *
*/
public EmployeeObject createEmployee(
String accessToken, String xeroTenantId, Employee employee, String idempotencyKey)
throws IOException {
try {
TypeReference typeRef = new TypeReference() {};
HttpResponse response =
createEmployeeForHttpResponse(accessToken, xeroTenantId, employee, idempotencyKey);
return apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
} catch (HttpResponseException e) {
if (logger.isDebugEnabled()) {
logger.debug(
"------------------ HttpResponseException "
+ e.getStatusCode()
+ " : createEmployee -------------------");
logger.debug(e.toString());
}
XeroApiExceptionHandler handler = new XeroApiExceptionHandler();
if (e.getStatusCode() == 400 || e.getStatusCode() == 405) {
TypeReference errorTypeRef = new TypeReference() {};
EmployeeObject object = apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef);
handler.validationError(e.getStatusCode(), "EmployeeObject", object.getProblem(), e);
} else {
handler.execute(e);
}
} catch (IOException ioe) {
throw ioe;
}
return null;
}
/**
* Creates an employees
*
* 200 - search results matching criteria
*
*
400 - validation error for a bad request
*
* @param xeroTenantId Xero identifier for Tenant
* @param employee The employee parameter
* @param idempotencyKey This allows you to safely retry requests without the risk of duplicate
* processing. 128 character max.
* @param accessToken Authorization token for user set in header of each request
* @return HttpResponse
* @throws IOException if an error occurs while attempting to invoke the API
*/
public HttpResponse createEmployeeForHttpResponse(
String accessToken, String xeroTenantId, Employee employee, String idempotencyKey)
throws IOException {
// verify the required parameter 'xeroTenantId' is set
if (xeroTenantId == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'xeroTenantId' when calling createEmployee");
} // verify the required parameter 'employee' is set
if (employee == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'employee' when calling createEmployee");
}
if (accessToken == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'accessToken' when calling createEmployee");
}
HttpHeaders headers = new HttpHeaders();
headers.set("Xero-Tenant-Id", xeroTenantId);
headers.set("Idempotency-Key", idempotencyKey);
headers.setAccept("application/json");
headers.setContentType("application/json");
headers.setUserAgent(this.getUserAgent());
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Employees");
String url = uriBuilder.build().toString();
GenericUrl genericUrl = new GenericUrl(url);
if (logger.isDebugEnabled()) {
logger.debug("POST " + genericUrl.toString());
}
HttpContent content = null;
content = apiClient.new JacksonJsonHttpContent(employee);
Credential credential =
new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken);
HttpTransport transport = apiClient.getHttpTransport();
HttpRequestFactory requestFactory = transport.createRequestFactory(credential);
return requestFactory
.buildRequest(HttpMethods.POST, genericUrl, content)
.setHeaders(headers)
.setConnectTimeout(apiClient.getConnectionTimeout())
.setReadTimeout(apiClient.getReadTimeout())
.execute();
}
/**
* Creates earnings template records for an employee
*
*
200 - search results matching criteria
*
*
400 - validation error for a bad request
*
* @param xeroTenantId Xero identifier for Tenant
* @param employeeID Employee id for single object
* @param earningsTemplate The earningsTemplate parameter
* @param idempotencyKey This allows you to safely retry requests without the risk of duplicate
* processing. 128 character max.
* @param accessToken Authorization token for user set in header of each request
* @return EarningsTemplateObject
* @throws IOException if an error occurs while attempting to invoke the API *
*/
public EarningsTemplateObject createEmployeeEarningsTemplate(
String accessToken,
String xeroTenantId,
UUID employeeID,
EarningsTemplate earningsTemplate,
String idempotencyKey)
throws IOException {
try {
TypeReference typeRef =
new TypeReference() {};
HttpResponse response =
createEmployeeEarningsTemplateForHttpResponse(
accessToken, xeroTenantId, employeeID, earningsTemplate, idempotencyKey);
return apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
} catch (HttpResponseException e) {
if (logger.isDebugEnabled()) {
logger.debug(
"------------------ HttpResponseException "
+ e.getStatusCode()
+ " : createEmployeeEarningsTemplate -------------------");
logger.debug(e.toString());
}
XeroApiExceptionHandler handler = new XeroApiExceptionHandler();
if (e.getStatusCode() == 400 || e.getStatusCode() == 405) {
TypeReference errorTypeRef =
new TypeReference() {};
EarningsTemplateObject object =
apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef);
handler.validationError(
e.getStatusCode(), "EarningsTemplateObject", object.getProblem(), e);
} else {
handler.execute(e);
}
} catch (IOException ioe) {
throw ioe;
}
return null;
}
/**
* Creates earnings template records for an employee
*
* 200 - search results matching criteria
*
*
400 - validation error for a bad request
*
* @param xeroTenantId Xero identifier for Tenant
* @param employeeID Employee id for single object
* @param earningsTemplate The earningsTemplate parameter
* @param idempotencyKey This allows you to safely retry requests without the risk of duplicate
* processing. 128 character max.
* @param accessToken Authorization token for user set in header of each request
* @return HttpResponse
* @throws IOException if an error occurs while attempting to invoke the API
*/
public HttpResponse createEmployeeEarningsTemplateForHttpResponse(
String accessToken,
String xeroTenantId,
UUID employeeID,
EarningsTemplate earningsTemplate,
String idempotencyKey)
throws IOException {
// verify the required parameter 'xeroTenantId' is set
if (xeroTenantId == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'xeroTenantId' when calling"
+ " createEmployeeEarningsTemplate");
} // verify the required parameter 'employeeID' is set
if (employeeID == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'employeeID' when calling"
+ " createEmployeeEarningsTemplate");
} // verify the required parameter 'earningsTemplate' is set
if (earningsTemplate == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'earningsTemplate' when calling"
+ " createEmployeeEarningsTemplate");
}
if (accessToken == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'accessToken' when calling"
+ " createEmployeeEarningsTemplate");
}
HttpHeaders headers = new HttpHeaders();
headers.set("Xero-Tenant-Id", xeroTenantId);
headers.set("Idempotency-Key", idempotencyKey);
headers.setAccept("application/json");
headers.setContentType("application/json");
headers.setUserAgent(this.getUserAgent());
// create a map of path variables
final Map uriVariables = new HashMap();
uriVariables.put("EmployeeID", employeeID);
UriBuilder uriBuilder =
UriBuilder.fromUri(
apiClient.getBasePath() + "/Employees/{EmployeeID}/PayTemplates/Earnings");
String url = uriBuilder.buildFromMap(uriVariables).toString();
GenericUrl genericUrl = new GenericUrl(url);
if (logger.isDebugEnabled()) {
logger.debug("POST " + genericUrl.toString());
}
HttpContent content = null;
content = apiClient.new JacksonJsonHttpContent(earningsTemplate);
Credential credential =
new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken);
HttpTransport transport = apiClient.getHttpTransport();
HttpRequestFactory requestFactory = transport.createRequestFactory(credential);
return requestFactory
.buildRequest(HttpMethods.POST, genericUrl, content)
.setHeaders(headers)
.setConnectTimeout(apiClient.getConnectionTimeout())
.setReadTimeout(apiClient.getReadTimeout())
.execute();
}
/**
* Creates leave records for a specific employee
*
* 200 - search results matching criteria
*
*
400 - validation error for a bad request
*
* @param xeroTenantId Xero identifier for Tenant
* @param employeeID Employee id for single object
* @param employeeLeave The employeeLeave parameter
* @param idempotencyKey This allows you to safely retry requests without the risk of duplicate
* processing. 128 character max.
* @param accessToken Authorization token for user set in header of each request
* @return EmployeeLeaveObject
* @throws IOException if an error occurs while attempting to invoke the API *
*/
public EmployeeLeaveObject createEmployeeLeave(
String accessToken,
String xeroTenantId,
UUID employeeID,
EmployeeLeave employeeLeave,
String idempotencyKey)
throws IOException {
try {
TypeReference typeRef = new TypeReference() {};
HttpResponse response =
createEmployeeLeaveForHttpResponse(
accessToken, xeroTenantId, employeeID, employeeLeave, idempotencyKey);
return apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
} catch (HttpResponseException e) {
if (logger.isDebugEnabled()) {
logger.debug(
"------------------ HttpResponseException "
+ e.getStatusCode()
+ " : createEmployeeLeave -------------------");
logger.debug(e.toString());
}
XeroApiExceptionHandler handler = new XeroApiExceptionHandler();
if (e.getStatusCode() == 400 || e.getStatusCode() == 405) {
TypeReference errorTypeRef =
new TypeReference() {};
EmployeeLeaveObject object =
apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef);
handler.validationError(e.getStatusCode(), "EmployeeLeaveObject", object.getProblem(), e);
} else {
handler.execute(e);
}
} catch (IOException ioe) {
throw ioe;
}
return null;
}
/**
* Creates leave records for a specific employee
*
* 200 - search results matching criteria
*
*
400 - validation error for a bad request
*
* @param xeroTenantId Xero identifier for Tenant
* @param employeeID Employee id for single object
* @param employeeLeave The employeeLeave parameter
* @param idempotencyKey This allows you to safely retry requests without the risk of duplicate
* processing. 128 character max.
* @param accessToken Authorization token for user set in header of each request
* @return HttpResponse
* @throws IOException if an error occurs while attempting to invoke the API
*/
public HttpResponse createEmployeeLeaveForHttpResponse(
String accessToken,
String xeroTenantId,
UUID employeeID,
EmployeeLeave employeeLeave,
String idempotencyKey)
throws IOException {
// verify the required parameter 'xeroTenantId' is set
if (xeroTenantId == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'xeroTenantId' when calling createEmployeeLeave");
} // verify the required parameter 'employeeID' is set
if (employeeID == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'employeeID' when calling createEmployeeLeave");
} // verify the required parameter 'employeeLeave' is set
if (employeeLeave == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'employeeLeave' when calling createEmployeeLeave");
}
if (accessToken == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'accessToken' when calling createEmployeeLeave");
}
HttpHeaders headers = new HttpHeaders();
headers.set("Xero-Tenant-Id", xeroTenantId);
headers.set("Idempotency-Key", idempotencyKey);
headers.setAccept("application/json");
headers.setContentType("application/json");
headers.setUserAgent(this.getUserAgent());
// create a map of path variables
final Map uriVariables = new HashMap();
uriVariables.put("EmployeeID", employeeID);
UriBuilder uriBuilder =
UriBuilder.fromUri(apiClient.getBasePath() + "/Employees/{EmployeeID}/Leave");
String url = uriBuilder.buildFromMap(uriVariables).toString();
GenericUrl genericUrl = new GenericUrl(url);
if (logger.isDebugEnabled()) {
logger.debug("POST " + genericUrl.toString());
}
HttpContent content = null;
content = apiClient.new JacksonJsonHttpContent(employeeLeave);
Credential credential =
new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken);
HttpTransport transport = apiClient.getHttpTransport();
HttpRequestFactory requestFactory = transport.createRequestFactory(credential);
return requestFactory
.buildRequest(HttpMethods.POST, genericUrl, content)
.setHeaders(headers)
.setConnectTimeout(apiClient.getConnectionTimeout())
.setReadTimeout(apiClient.getReadTimeout())
.execute();
}
/**
* Creates a leave set-up for a specific employee. This is required before viewing, configuring
* and requesting leave for an employee
*
* 200 - search results matching criteria
*
*
400 - validation error for a bad request
*
* @param xeroTenantId Xero identifier for Tenant
* @param employeeID Employee id for single object
* @param employeeLeaveSetup The employeeLeaveSetup parameter
* @param idempotencyKey This allows you to safely retry requests without the risk of duplicate
* processing. 128 character max.
* @param accessToken Authorization token for user set in header of each request
* @return EmployeeLeaveSetupObject
* @throws IOException if an error occurs while attempting to invoke the API *
*/
public EmployeeLeaveSetupObject createEmployeeLeaveSetup(
String accessToken,
String xeroTenantId,
UUID employeeID,
EmployeeLeaveSetup employeeLeaveSetup,
String idempotencyKey)
throws IOException {
try {
TypeReference typeRef =
new TypeReference() {};
HttpResponse response =
createEmployeeLeaveSetupForHttpResponse(
accessToken, xeroTenantId, employeeID, employeeLeaveSetup, idempotencyKey);
return apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
} catch (HttpResponseException e) {
if (logger.isDebugEnabled()) {
logger.debug(
"------------------ HttpResponseException "
+ e.getStatusCode()
+ " : createEmployeeLeaveSetup -------------------");
logger.debug(e.toString());
}
XeroApiExceptionHandler handler = new XeroApiExceptionHandler();
if (e.getStatusCode() == 400 || e.getStatusCode() == 405) {
TypeReference errorTypeRef =
new TypeReference() {};
EmployeeLeaveSetupObject object =
apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef);
handler.validationError(
e.getStatusCode(), "EmployeeLeaveSetupObject", object.getProblem(), e);
} else {
handler.execute(e);
}
} catch (IOException ioe) {
throw ioe;
}
return null;
}
/**
* Creates a leave set-up for a specific employee. This is required before viewing, configuring
* and requesting leave for an employee
*
* 200 - search results matching criteria
*
*
400 - validation error for a bad request
*
* @param xeroTenantId Xero identifier for Tenant
* @param employeeID Employee id for single object
* @param employeeLeaveSetup The employeeLeaveSetup parameter
* @param idempotencyKey This allows you to safely retry requests without the risk of duplicate
* processing. 128 character max.
* @param accessToken Authorization token for user set in header of each request
* @return HttpResponse
* @throws IOException if an error occurs while attempting to invoke the API
*/
public HttpResponse createEmployeeLeaveSetupForHttpResponse(
String accessToken,
String xeroTenantId,
UUID employeeID,
EmployeeLeaveSetup employeeLeaveSetup,
String idempotencyKey)
throws IOException {
// verify the required parameter 'xeroTenantId' is set
if (xeroTenantId == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'xeroTenantId' when calling createEmployeeLeaveSetup");
} // verify the required parameter 'employeeID' is set
if (employeeID == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'employeeID' when calling createEmployeeLeaveSetup");
} // verify the required parameter 'employeeLeaveSetup' is set
if (employeeLeaveSetup == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'employeeLeaveSetup' when calling"
+ " createEmployeeLeaveSetup");
}
if (accessToken == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'accessToken' when calling createEmployeeLeaveSetup");
}
HttpHeaders headers = new HttpHeaders();
headers.set("Xero-Tenant-Id", xeroTenantId);
headers.set("Idempotency-Key", idempotencyKey);
headers.setAccept("application/json");
headers.setContentType("application/json");
headers.setUserAgent(this.getUserAgent());
// create a map of path variables
final Map uriVariables = new HashMap();
uriVariables.put("EmployeeID", employeeID);
UriBuilder uriBuilder =
UriBuilder.fromUri(apiClient.getBasePath() + "/Employees/{EmployeeID}/LeaveSetup");
String url = uriBuilder.buildFromMap(uriVariables).toString();
GenericUrl genericUrl = new GenericUrl(url);
if (logger.isDebugEnabled()) {
logger.debug("POST " + genericUrl.toString());
}
HttpContent content = null;
content = apiClient.new JacksonJsonHttpContent(employeeLeaveSetup);
Credential credential =
new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken);
HttpTransport transport = apiClient.getHttpTransport();
HttpRequestFactory requestFactory = transport.createRequestFactory(credential);
return requestFactory
.buildRequest(HttpMethods.POST, genericUrl, content)
.setHeaders(headers)
.setConnectTimeout(apiClient.getConnectionTimeout())
.setReadTimeout(apiClient.getReadTimeout())
.execute();
}
/**
* Creates leave type records for a specific employee
*
* 200 - search results matching criteria
*
*
400 - validation error for a bad request
*
* @param xeroTenantId Xero identifier for Tenant
* @param employeeID Employee id for single object
* @param employeeLeaveType The employeeLeaveType parameter
* @param idempotencyKey This allows you to safely retry requests without the risk of duplicate
* processing. 128 character max.
* @param accessToken Authorization token for user set in header of each request
* @return EmployeeLeaveTypeObject
* @throws IOException if an error occurs while attempting to invoke the API *
*/
public EmployeeLeaveTypeObject createEmployeeLeaveType(
String accessToken,
String xeroTenantId,
UUID employeeID,
EmployeeLeaveType employeeLeaveType,
String idempotencyKey)
throws IOException {
try {
TypeReference typeRef =
new TypeReference() {};
HttpResponse response =
createEmployeeLeaveTypeForHttpResponse(
accessToken, xeroTenantId, employeeID, employeeLeaveType, idempotencyKey);
return apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
} catch (HttpResponseException e) {
if (logger.isDebugEnabled()) {
logger.debug(
"------------------ HttpResponseException "
+ e.getStatusCode()
+ " : createEmployeeLeaveType -------------------");
logger.debug(e.toString());
}
XeroApiExceptionHandler handler = new XeroApiExceptionHandler();
if (e.getStatusCode() == 400 || e.getStatusCode() == 405) {
TypeReference errorTypeRef =
new TypeReference() {};
EmployeeLeaveTypeObject object =
apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef);
handler.validationError(
e.getStatusCode(), "EmployeeLeaveTypeObject", object.getProblem(), e);
} else {
handler.execute(e);
}
} catch (IOException ioe) {
throw ioe;
}
return null;
}
/**
* Creates leave type records for a specific employee
*
* 200 - search results matching criteria
*
*
400 - validation error for a bad request
*
* @param xeroTenantId Xero identifier for Tenant
* @param employeeID Employee id for single object
* @param employeeLeaveType The employeeLeaveType parameter
* @param idempotencyKey This allows you to safely retry requests without the risk of duplicate
* processing. 128 character max.
* @param accessToken Authorization token for user set in header of each request
* @return HttpResponse
* @throws IOException if an error occurs while attempting to invoke the API
*/
public HttpResponse createEmployeeLeaveTypeForHttpResponse(
String accessToken,
String xeroTenantId,
UUID employeeID,
EmployeeLeaveType employeeLeaveType,
String idempotencyKey)
throws IOException {
// verify the required parameter 'xeroTenantId' is set
if (xeroTenantId == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'xeroTenantId' when calling createEmployeeLeaveType");
} // verify the required parameter 'employeeID' is set
if (employeeID == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'employeeID' when calling createEmployeeLeaveType");
} // verify the required parameter 'employeeLeaveType' is set
if (employeeLeaveType == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'employeeLeaveType' when calling"
+ " createEmployeeLeaveType");
}
if (accessToken == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'accessToken' when calling createEmployeeLeaveType");
}
HttpHeaders headers = new HttpHeaders();
headers.set("Xero-Tenant-Id", xeroTenantId);
headers.set("Idempotency-Key", idempotencyKey);
headers.setAccept("application/json");
headers.setContentType("application/json");
headers.setUserAgent(this.getUserAgent());
// create a map of path variables
final Map uriVariables = new HashMap();
uriVariables.put("EmployeeID", employeeID);
UriBuilder uriBuilder =
UriBuilder.fromUri(apiClient.getBasePath() + "/Employees/{EmployeeID}/LeaveTypes");
String url = uriBuilder.buildFromMap(uriVariables).toString();
GenericUrl genericUrl = new GenericUrl(url);
if (logger.isDebugEnabled()) {
logger.debug("POST " + genericUrl.toString());
}
HttpContent content = null;
content = apiClient.new JacksonJsonHttpContent(employeeLeaveType);
Credential credential =
new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken);
HttpTransport transport = apiClient.getHttpTransport();
HttpRequestFactory requestFactory = transport.createRequestFactory(credential);
return requestFactory
.buildRequest(HttpMethods.POST, genericUrl, content)
.setHeaders(headers)
.setConnectTimeout(apiClient.getConnectionTimeout())
.setReadTimeout(apiClient.getReadTimeout())
.execute();
}
/**
* Creates opening balances for a specific employee
*
* 200 - search results matching criteria
*
*
400 - validation error for a bad request
*
* @param xeroTenantId Xero identifier for Tenant
* @param employeeID Employee id for single object
* @param employeeOpeningBalance The employeeOpeningBalance parameter
* @param idempotencyKey This allows you to safely retry requests without the risk of duplicate
* processing. 128 character max.
* @param accessToken Authorization token for user set in header of each request
* @return EmployeeOpeningBalancesObject
* @throws IOException if an error occurs while attempting to invoke the API *
*/
public EmployeeOpeningBalancesObject createEmployeeOpeningBalances(
String accessToken,
String xeroTenantId,
UUID employeeID,
List employeeOpeningBalance,
String idempotencyKey)
throws IOException {
try {
TypeReference typeRef =
new TypeReference() {};
HttpResponse response =
createEmployeeOpeningBalancesForHttpResponse(
accessToken, xeroTenantId, employeeID, employeeOpeningBalance, idempotencyKey);
return apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
} catch (HttpResponseException e) {
if (logger.isDebugEnabled()) {
logger.debug(
"------------------ HttpResponseException "
+ e.getStatusCode()
+ " : createEmployeeOpeningBalances -------------------");
logger.debug(e.toString());
}
XeroApiExceptionHandler handler = new XeroApiExceptionHandler();
if (e.getStatusCode() == 400 || e.getStatusCode() == 405) {
TypeReference errorTypeRef =
new TypeReference() {};
EmployeeOpeningBalancesObject object =
apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef);
handler.validationError(
e.getStatusCode(), "EmployeeOpeningBalancesObject", object.getProblem(), e);
} else {
handler.execute(e);
}
} catch (IOException ioe) {
throw ioe;
}
return null;
}
/**
* Creates opening balances for a specific employee
*
* 200 - search results matching criteria
*
*
400 - validation error for a bad request
*
* @param xeroTenantId Xero identifier for Tenant
* @param employeeID Employee id for single object
* @param employeeOpeningBalance The employeeOpeningBalance parameter
* @param idempotencyKey This allows you to safely retry requests without the risk of duplicate
* processing. 128 character max.
* @param accessToken Authorization token for user set in header of each request
* @return HttpResponse
* @throws IOException if an error occurs while attempting to invoke the API
*/
public HttpResponse createEmployeeOpeningBalancesForHttpResponse(
String accessToken,
String xeroTenantId,
UUID employeeID,
List employeeOpeningBalance,
String idempotencyKey)
throws IOException {
// verify the required parameter 'xeroTenantId' is set
if (xeroTenantId == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'xeroTenantId' when calling"
+ " createEmployeeOpeningBalances");
} // verify the required parameter 'employeeID' is set
if (employeeID == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'employeeID' when calling createEmployeeOpeningBalances");
} // verify the required parameter 'employeeOpeningBalance' is set
if (employeeOpeningBalance == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'employeeOpeningBalance' when calling"
+ " createEmployeeOpeningBalances");
}
if (accessToken == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'accessToken' when calling"
+ " createEmployeeOpeningBalances");
}
HttpHeaders headers = new HttpHeaders();
headers.set("Xero-Tenant-Id", xeroTenantId);
headers.set("Idempotency-Key", idempotencyKey);
headers.setAccept("application/json");
headers.setContentType("application/json");
headers.setUserAgent(this.getUserAgent());
// create a map of path variables
final Map uriVariables = new HashMap();
uriVariables.put("EmployeeID", employeeID);
UriBuilder uriBuilder =
UriBuilder.fromUri(apiClient.getBasePath() + "/Employees/{EmployeeID}/OpeningBalances");
String url = uriBuilder.buildFromMap(uriVariables).toString();
GenericUrl genericUrl = new GenericUrl(url);
if (logger.isDebugEnabled()) {
logger.debug("POST " + genericUrl.toString());
}
HttpContent content = null;
content = apiClient.new JacksonJsonHttpContent(employeeOpeningBalance);
Credential credential =
new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken);
HttpTransport transport = apiClient.getHttpTransport();
HttpRequestFactory requestFactory = transport.createRequestFactory(credential);
return requestFactory
.buildRequest(HttpMethods.POST, genericUrl, content)
.setHeaders(headers)
.setConnectTimeout(apiClient.getConnectionTimeout())
.setReadTimeout(apiClient.getReadTimeout())
.execute();
}
/**
* Creates a payment method for an employee
*
* 200 - search results matching criteria
*
*
400 - validation error for a bad request
*
* @param xeroTenantId Xero identifier for Tenant
* @param employeeID Employee id for single object
* @param paymentMethod The paymentMethod parameter
* @param idempotencyKey This allows you to safely retry requests without the risk of duplicate
* processing. 128 character max.
* @param accessToken Authorization token for user set in header of each request
* @return PaymentMethodObject
* @throws IOException if an error occurs while attempting to invoke the API *
*/
public PaymentMethodObject createEmployeePaymentMethod(
String accessToken,
String xeroTenantId,
UUID employeeID,
PaymentMethod paymentMethod,
String idempotencyKey)
throws IOException {
try {
TypeReference typeRef = new TypeReference() {};
HttpResponse response =
createEmployeePaymentMethodForHttpResponse(
accessToken, xeroTenantId, employeeID, paymentMethod, idempotencyKey);
return apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
} catch (HttpResponseException e) {
if (logger.isDebugEnabled()) {
logger.debug(
"------------------ HttpResponseException "
+ e.getStatusCode()
+ " : createEmployeePaymentMethod -------------------");
logger.debug(e.toString());
}
XeroApiExceptionHandler handler = new XeroApiExceptionHandler();
if (e.getStatusCode() == 400 || e.getStatusCode() == 405) {
TypeReference errorTypeRef =
new TypeReference() {};
PaymentMethodObject object =
apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef);
handler.validationError(e.getStatusCode(), "PaymentMethodObject", object.getProblem(), e);
} else {
handler.execute(e);
}
} catch (IOException ioe) {
throw ioe;
}
return null;
}
/**
* Creates a payment method for an employee
*
* 200 - search results matching criteria
*
*
400 - validation error for a bad request
*
* @param xeroTenantId Xero identifier for Tenant
* @param employeeID Employee id for single object
* @param paymentMethod The paymentMethod parameter
* @param idempotencyKey This allows you to safely retry requests without the risk of duplicate
* processing. 128 character max.
* @param accessToken Authorization token for user set in header of each request
* @return HttpResponse
* @throws IOException if an error occurs while attempting to invoke the API
*/
public HttpResponse createEmployeePaymentMethodForHttpResponse(
String accessToken,
String xeroTenantId,
UUID employeeID,
PaymentMethod paymentMethod,
String idempotencyKey)
throws IOException {
// verify the required parameter 'xeroTenantId' is set
if (xeroTenantId == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'xeroTenantId' when calling createEmployeePaymentMethod");
} // verify the required parameter 'employeeID' is set
if (employeeID == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'employeeID' when calling createEmployeePaymentMethod");
} // verify the required parameter 'paymentMethod' is set
if (paymentMethod == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'paymentMethod' when calling"
+ " createEmployeePaymentMethod");
}
if (accessToken == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'accessToken' when calling createEmployeePaymentMethod");
}
HttpHeaders headers = new HttpHeaders();
headers.set("Xero-Tenant-Id", xeroTenantId);
headers.set("Idempotency-Key", idempotencyKey);
headers.setAccept("application/json");
headers.setContentType("application/json");
headers.setUserAgent(this.getUserAgent());
// create a map of path variables
final Map uriVariables = new HashMap();
uriVariables.put("EmployeeID", employeeID);
UriBuilder uriBuilder =
UriBuilder.fromUri(apiClient.getBasePath() + "/Employees/{EmployeeID}/PaymentMethods");
String url = uriBuilder.buildFromMap(uriVariables).toString();
GenericUrl genericUrl = new GenericUrl(url);
if (logger.isDebugEnabled()) {
logger.debug("POST " + genericUrl.toString());
}
HttpContent content = null;
content = apiClient.new JacksonJsonHttpContent(paymentMethod);
Credential credential =
new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken);
HttpTransport transport = apiClient.getHttpTransport();
HttpRequestFactory requestFactory = transport.createRequestFactory(credential);
return requestFactory
.buildRequest(HttpMethods.POST, genericUrl, content)
.setHeaders(headers)
.setConnectTimeout(apiClient.getConnectionTimeout())
.setReadTimeout(apiClient.getReadTimeout())
.execute();
}
/**
* Creates an employee salary and wage record
*
* 200 - search results matching criteria
*
*
400 - validation error for a bad request
*
* @param xeroTenantId Xero identifier for Tenant
* @param employeeID Employee id for single object
* @param salaryAndWage The salaryAndWage parameter
* @param idempotencyKey This allows you to safely retry requests without the risk of duplicate
* processing. 128 character max.
* @param accessToken Authorization token for user set in header of each request
* @return SalaryAndWageObject
* @throws IOException if an error occurs while attempting to invoke the API *
*/
public SalaryAndWageObject createEmployeeSalaryAndWage(
String accessToken,
String xeroTenantId,
UUID employeeID,
SalaryAndWage salaryAndWage,
String idempotencyKey)
throws IOException {
try {
TypeReference typeRef = new TypeReference() {};
HttpResponse response =
createEmployeeSalaryAndWageForHttpResponse(
accessToken, xeroTenantId, employeeID, salaryAndWage, idempotencyKey);
return apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
} catch (HttpResponseException e) {
if (logger.isDebugEnabled()) {
logger.debug(
"------------------ HttpResponseException "
+ e.getStatusCode()
+ " : createEmployeeSalaryAndWage -------------------");
logger.debug(e.toString());
}
XeroApiExceptionHandler handler = new XeroApiExceptionHandler();
if (e.getStatusCode() == 400 || e.getStatusCode() == 405) {
TypeReference errorTypeRef =
new TypeReference() {};
SalaryAndWageObject object =
apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef);
handler.validationError(e.getStatusCode(), "SalaryAndWageObject", object.getProblem(), e);
} else {
handler.execute(e);
}
} catch (IOException ioe) {
throw ioe;
}
return null;
}
/**
* Creates an employee salary and wage record
*
* 200 - search results matching criteria
*
*
400 - validation error for a bad request
*
* @param xeroTenantId Xero identifier for Tenant
* @param employeeID Employee id for single object
* @param salaryAndWage The salaryAndWage parameter
* @param idempotencyKey This allows you to safely retry requests without the risk of duplicate
* processing. 128 character max.
* @param accessToken Authorization token for user set in header of each request
* @return HttpResponse
* @throws IOException if an error occurs while attempting to invoke the API
*/
public HttpResponse createEmployeeSalaryAndWageForHttpResponse(
String accessToken,
String xeroTenantId,
UUID employeeID,
SalaryAndWage salaryAndWage,
String idempotencyKey)
throws IOException {
// verify the required parameter 'xeroTenantId' is set
if (xeroTenantId == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'xeroTenantId' when calling createEmployeeSalaryAndWage");
} // verify the required parameter 'employeeID' is set
if (employeeID == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'employeeID' when calling createEmployeeSalaryAndWage");
} // verify the required parameter 'salaryAndWage' is set
if (salaryAndWage == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'salaryAndWage' when calling"
+ " createEmployeeSalaryAndWage");
}
if (accessToken == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'accessToken' when calling createEmployeeSalaryAndWage");
}
HttpHeaders headers = new HttpHeaders();
headers.set("Xero-Tenant-Id", xeroTenantId);
headers.set("Idempotency-Key", idempotencyKey);
headers.setAccept("application/json");
headers.setContentType("application/json");
headers.setUserAgent(this.getUserAgent());
// create a map of path variables
final Map uriVariables = new HashMap();
uriVariables.put("EmployeeID", employeeID);
UriBuilder uriBuilder =
UriBuilder.fromUri(apiClient.getBasePath() + "/Employees/{EmployeeID}/SalaryAndWages");
String url = uriBuilder.buildFromMap(uriVariables).toString();
GenericUrl genericUrl = new GenericUrl(url);
if (logger.isDebugEnabled()) {
logger.debug("POST " + genericUrl.toString());
}
HttpContent content = null;
content = apiClient.new JacksonJsonHttpContent(salaryAndWage);
Credential credential =
new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken);
HttpTransport transport = apiClient.getHttpTransport();
HttpRequestFactory requestFactory = transport.createRequestFactory(credential);
return requestFactory
.buildRequest(HttpMethods.POST, genericUrl, content)
.setHeaders(headers)
.setConnectTimeout(apiClient.getConnectionTimeout())
.setReadTimeout(apiClient.getReadTimeout())
.execute();
}
/**
* Creates an employee working pattern
*
* 200 - employee working pattern correctly added
*
*
400 - validation error for a bad request
*
* @param xeroTenantId Xero identifier for Tenant
* @param employeeID Employee id for single object
* @param employeeWorkingPatternWithWorkingWeeksRequest The
* employeeWorkingPatternWithWorkingWeeksRequest parameter
* @param idempotencyKey This allows you to safely retry requests without the risk of duplicate
* processing. 128 character max.
* @param accessToken Authorization token for user set in header of each request
* @return EmployeeWorkingPatternWithWorkingWeeksObject
* @throws IOException if an error occurs while attempting to invoke the API *
*/
public EmployeeWorkingPatternWithWorkingWeeksObject createEmployeeWorkingPattern(
String accessToken,
String xeroTenantId,
UUID employeeID,
EmployeeWorkingPatternWithWorkingWeeksRequest employeeWorkingPatternWithWorkingWeeksRequest,
String idempotencyKey)
throws IOException {
try {
TypeReference typeRef =
new TypeReference() {};
HttpResponse response =
createEmployeeWorkingPatternForHttpResponse(
accessToken,
xeroTenantId,
employeeID,
employeeWorkingPatternWithWorkingWeeksRequest,
idempotencyKey);
return apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
} catch (HttpResponseException e) {
if (logger.isDebugEnabled()) {
logger.debug(
"------------------ HttpResponseException "
+ e.getStatusCode()
+ " : createEmployeeWorkingPattern -------------------");
logger.debug(e.toString());
}
XeroApiExceptionHandler handler = new XeroApiExceptionHandler();
if (e.getStatusCode() == 400 || e.getStatusCode() == 405) {
TypeReference errorTypeRef =
new TypeReference() {};
EmployeeWorkingPatternWithWorkingWeeksObject object =
apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef);
handler.validationError(
e.getStatusCode(),
"EmployeeWorkingPatternWithWorkingWeeksObject",
object.getProblem(),
e);
} else {
handler.execute(e);
}
} catch (IOException ioe) {
throw ioe;
}
return null;
}
/**
* Creates an employee working pattern
*
* 200 - employee working pattern correctly added
*
*
400 - validation error for a bad request
*
* @param xeroTenantId Xero identifier for Tenant
* @param employeeID Employee id for single object
* @param employeeWorkingPatternWithWorkingWeeksRequest The
* employeeWorkingPatternWithWorkingWeeksRequest parameter
* @param idempotencyKey This allows you to safely retry requests without the risk of duplicate
* processing. 128 character max.
* @param accessToken Authorization token for user set in header of each request
* @return HttpResponse
* @throws IOException if an error occurs while attempting to invoke the API
*/
public HttpResponse createEmployeeWorkingPatternForHttpResponse(
String accessToken,
String xeroTenantId,
UUID employeeID,
EmployeeWorkingPatternWithWorkingWeeksRequest employeeWorkingPatternWithWorkingWeeksRequest,
String idempotencyKey)
throws IOException {
// verify the required parameter 'xeroTenantId' is set
if (xeroTenantId == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'xeroTenantId' when calling"
+ " createEmployeeWorkingPattern");
} // verify the required parameter 'employeeID' is set
if (employeeID == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'employeeID' when calling createEmployeeWorkingPattern");
} // verify the required parameter 'employeeWorkingPatternWithWorkingWeeksRequest' is set
if (employeeWorkingPatternWithWorkingWeeksRequest == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'employeeWorkingPatternWithWorkingWeeksRequest' when"
+ " calling createEmployeeWorkingPattern");
}
if (accessToken == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'accessToken' when calling createEmployeeWorkingPattern");
}
HttpHeaders headers = new HttpHeaders();
headers.set("Xero-Tenant-Id", xeroTenantId);
headers.set("Idempotency-Key", idempotencyKey);
headers.setAccept("application/json");
headers.setContentType("application/json");
headers.setUserAgent(this.getUserAgent());
// create a map of path variables
final Map uriVariables = new HashMap();
uriVariables.put("EmployeeID", employeeID);
UriBuilder uriBuilder =
UriBuilder.fromUri(apiClient.getBasePath() + "/Employees/{EmployeeID}/Working-Patterns");
String url = uriBuilder.buildFromMap(uriVariables).toString();
GenericUrl genericUrl = new GenericUrl(url);
if (logger.isDebugEnabled()) {
logger.debug("POST " + genericUrl.toString());
}
HttpContent content = null;
content = apiClient.new JacksonJsonHttpContent(employeeWorkingPatternWithWorkingWeeksRequest);
Credential credential =
new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken);
HttpTransport transport = apiClient.getHttpTransport();
HttpRequestFactory requestFactory = transport.createRequestFactory(credential);
return requestFactory
.buildRequest(HttpMethods.POST, genericUrl, content)
.setHeaders(headers)
.setConnectTimeout(apiClient.getConnectionTimeout())
.setReadTimeout(apiClient.getReadTimeout())
.execute();
}
/**
* Creates an employment detail for a specific employee
*
* 200 - search results matching criteria
*
*
400 - validation error for a bad request
*
* @param xeroTenantId Xero identifier for Tenant
* @param employeeID Employee id for single object
* @param employment The employment parameter
* @param idempotencyKey This allows you to safely retry requests without the risk of duplicate
* processing. 128 character max.
* @param accessToken Authorization token for user set in header of each request
* @return EmploymentObject
* @throws IOException if an error occurs while attempting to invoke the API *
*/
public EmploymentObject createEmployment(
String accessToken,
String xeroTenantId,
UUID employeeID,
Employment employment,
String idempotencyKey)
throws IOException {
try {
TypeReference typeRef = new TypeReference() {};
HttpResponse response =
createEmploymentForHttpResponse(
accessToken, xeroTenantId, employeeID, employment, idempotencyKey);
return apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
} catch (HttpResponseException e) {
if (logger.isDebugEnabled()) {
logger.debug(
"------------------ HttpResponseException "
+ e.getStatusCode()
+ " : createEmployment -------------------");
logger.debug(e.toString());
}
XeroApiExceptionHandler handler = new XeroApiExceptionHandler();
if (e.getStatusCode() == 400 || e.getStatusCode() == 405) {
TypeReference errorTypeRef = new TypeReference() {};
EmploymentObject object =
apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef);
handler.validationError(e.getStatusCode(), "EmploymentObject", object.getProblem(), e);
} else {
handler.execute(e);
}
} catch (IOException ioe) {
throw ioe;
}
return null;
}
/**
* Creates an employment detail for a specific employee
*
* 200 - search results matching criteria
*
*
400 - validation error for a bad request
*
* @param xeroTenantId Xero identifier for Tenant
* @param employeeID Employee id for single object
* @param employment The employment parameter
* @param idempotencyKey This allows you to safely retry requests without the risk of duplicate
* processing. 128 character max.
* @param accessToken Authorization token for user set in header of each request
* @return HttpResponse
* @throws IOException if an error occurs while attempting to invoke the API
*/
public HttpResponse createEmploymentForHttpResponse(
String accessToken,
String xeroTenantId,
UUID employeeID,
Employment employment,
String idempotencyKey)
throws IOException {
// verify the required parameter 'xeroTenantId' is set
if (xeroTenantId == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'xeroTenantId' when calling createEmployment");
} // verify the required parameter 'employeeID' is set
if (employeeID == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'employeeID' when calling createEmployment");
} // verify the required parameter 'employment' is set
if (employment == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'employment' when calling createEmployment");
}
if (accessToken == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'accessToken' when calling createEmployment");
}
HttpHeaders headers = new HttpHeaders();
headers.set("Xero-Tenant-Id", xeroTenantId);
headers.set("Idempotency-Key", idempotencyKey);
headers.setAccept("application/json");
headers.setContentType("application/json");
headers.setUserAgent(this.getUserAgent());
// create a map of path variables
final Map uriVariables = new HashMap();
uriVariables.put("EmployeeID", employeeID);
UriBuilder uriBuilder =
UriBuilder.fromUri(apiClient.getBasePath() + "/Employees/{EmployeeID}/Employment");
String url = uriBuilder.buildFromMap(uriVariables).toString();
GenericUrl genericUrl = new GenericUrl(url);
if (logger.isDebugEnabled()) {
logger.debug("POST " + genericUrl.toString());
}
HttpContent content = null;
content = apiClient.new JacksonJsonHttpContent(employment);
Credential credential =
new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken);
HttpTransport transport = apiClient.getHttpTransport();
HttpRequestFactory requestFactory = transport.createRequestFactory(credential);
return requestFactory
.buildRequest(HttpMethods.POST, genericUrl, content)
.setHeaders(headers)
.setConnectTimeout(apiClient.getConnectionTimeout())
.setReadTimeout(apiClient.getReadTimeout())
.execute();
}
/**
* Creates a new leave type
*
* 200 - search results matching criteria
*
*
400 - validation error for a bad request
*
* @param xeroTenantId Xero identifier for Tenant
* @param leaveType The leaveType parameter
* @param idempotencyKey This allows you to safely retry requests without the risk of duplicate
* processing. 128 character max.
* @param accessToken Authorization token for user set in header of each request
* @return LeaveTypeObject
* @throws IOException if an error occurs while attempting to invoke the API *
*/
public LeaveTypeObject createLeaveType(
String accessToken, String xeroTenantId, LeaveType leaveType, String idempotencyKey)
throws IOException {
try {
TypeReference typeRef = new TypeReference() {};
HttpResponse response =
createLeaveTypeForHttpResponse(accessToken, xeroTenantId, leaveType, idempotencyKey);
return apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
} catch (HttpResponseException e) {
if (logger.isDebugEnabled()) {
logger.debug(
"------------------ HttpResponseException "
+ e.getStatusCode()
+ " : createLeaveType -------------------");
logger.debug(e.toString());
}
XeroApiExceptionHandler handler = new XeroApiExceptionHandler();
if (e.getStatusCode() == 400 || e.getStatusCode() == 405) {
TypeReference errorTypeRef = new TypeReference() {};
LeaveTypeObject object =
apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef);
handler.validationError(e.getStatusCode(), "LeaveTypeObject", object.getProblem(), e);
} else {
handler.execute(e);
}
} catch (IOException ioe) {
throw ioe;
}
return null;
}
/**
* Creates a new leave type
*
* 200 - search results matching criteria
*
*
400 - validation error for a bad request
*
* @param xeroTenantId Xero identifier for Tenant
* @param leaveType The leaveType parameter
* @param idempotencyKey This allows you to safely retry requests without the risk of duplicate
* processing. 128 character max.
* @param accessToken Authorization token for user set in header of each request
* @return HttpResponse
* @throws IOException if an error occurs while attempting to invoke the API
*/
public HttpResponse createLeaveTypeForHttpResponse(
String accessToken, String xeroTenantId, LeaveType leaveType, String idempotencyKey)
throws IOException {
// verify the required parameter 'xeroTenantId' is set
if (xeroTenantId == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'xeroTenantId' when calling createLeaveType");
} // verify the required parameter 'leaveType' is set
if (leaveType == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'leaveType' when calling createLeaveType");
}
if (accessToken == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'accessToken' when calling createLeaveType");
}
HttpHeaders headers = new HttpHeaders();
headers.set("Xero-Tenant-Id", xeroTenantId);
headers.set("Idempotency-Key", idempotencyKey);
headers.setAccept("application/json");
headers.setContentType("application/json");
headers.setUserAgent(this.getUserAgent());
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/LeaveTypes");
String url = uriBuilder.build().toString();
GenericUrl genericUrl = new GenericUrl(url);
if (logger.isDebugEnabled()) {
logger.debug("POST " + genericUrl.toString());
}
HttpContent content = null;
content = apiClient.new JacksonJsonHttpContent(leaveType);
Credential credential =
new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken);
HttpTransport transport = apiClient.getHttpTransport();
HttpRequestFactory requestFactory = transport.createRequestFactory(credential);
return requestFactory
.buildRequest(HttpMethods.POST, genericUrl, content)
.setHeaders(headers)
.setConnectTimeout(apiClient.getConnectionTimeout())
.setReadTimeout(apiClient.getReadTimeout())
.execute();
}
/**
* Creates multiple employee earnings template records for a specific employee
*
*
200 - search results matching criteria
*
*
400 - validation error for a bad request
*
* @param xeroTenantId Xero identifier for Tenant
* @param employeeID Employee id for single object
* @param earningsTemplate The earningsTemplate parameter
* @param idempotencyKey This allows you to safely retry requests without the risk of duplicate
* processing. 128 character max.
* @param accessToken Authorization token for user set in header of each request
* @return EmployeeEarningsTemplates
* @throws IOException if an error occurs while attempting to invoke the API *
*/
public EmployeeEarningsTemplates createMultipleEmployeeEarningsTemplate(
String accessToken,
String xeroTenantId,
UUID employeeID,
List earningsTemplate,
String idempotencyKey)
throws IOException {
try {
TypeReference typeRef =
new TypeReference() {};
HttpResponse response =
createMultipleEmployeeEarningsTemplateForHttpResponse(
accessToken, xeroTenantId, employeeID, earningsTemplate, idempotencyKey);
return apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
} catch (HttpResponseException e) {
if (logger.isDebugEnabled()) {
logger.debug(
"------------------ HttpResponseException "
+ e.getStatusCode()
+ " : createMultipleEmployeeEarningsTemplate -------------------");
logger.debug(e.toString());
}
XeroApiExceptionHandler handler = new XeroApiExceptionHandler();
if (e.getStatusCode() == 400 || e.getStatusCode() == 405) {
TypeReference errorTypeRef =
new TypeReference() {};
EmployeeEarningsTemplates object =
apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef);
handler.validationError(
e.getStatusCode(), "EmployeeEarningsTemplates", object.getProblem(), e);
} else {
handler.execute(e);
}
} catch (IOException ioe) {
throw ioe;
}
return null;
}
/**
* Creates multiple employee earnings template records for a specific employee
*
* 200 - search results matching criteria
*
*
400 - validation error for a bad request
*
* @param xeroTenantId Xero identifier for Tenant
* @param employeeID Employee id for single object
* @param earningsTemplate The earningsTemplate parameter
* @param idempotencyKey This allows you to safely retry requests without the risk of duplicate
* processing. 128 character max.
* @param accessToken Authorization token for user set in header of each request
* @return HttpResponse
* @throws IOException if an error occurs while attempting to invoke the API
*/
public HttpResponse createMultipleEmployeeEarningsTemplateForHttpResponse(
String accessToken,
String xeroTenantId,
UUID employeeID,
List earningsTemplate,
String idempotencyKey)
throws IOException {
// verify the required parameter 'xeroTenantId' is set
if (xeroTenantId == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'xeroTenantId' when calling"
+ " createMultipleEmployeeEarningsTemplate");
} // verify the required parameter 'employeeID' is set
if (employeeID == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'employeeID' when calling"
+ " createMultipleEmployeeEarningsTemplate");
} // verify the required parameter 'earningsTemplate' is set
if (earningsTemplate == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'earningsTemplate' when calling"
+ " createMultipleEmployeeEarningsTemplate");
}
if (accessToken == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'accessToken' when calling"
+ " createMultipleEmployeeEarningsTemplate");
}
HttpHeaders headers = new HttpHeaders();
headers.set("Xero-Tenant-Id", xeroTenantId);
headers.set("Idempotency-Key", idempotencyKey);
headers.setAccept("application/json");
headers.setContentType("application/json");
headers.setUserAgent(this.getUserAgent());
// create a map of path variables
final Map uriVariables = new HashMap();
uriVariables.put("EmployeeID", employeeID);
UriBuilder uriBuilder =
UriBuilder.fromUri(apiClient.getBasePath() + "/Employees/{EmployeeID}/PayTemplateEarnings");
String url = uriBuilder.buildFromMap(uriVariables).toString();
GenericUrl genericUrl = new GenericUrl(url);
if (logger.isDebugEnabled()) {
logger.debug("POST " + genericUrl.toString());
}
HttpContent content = null;
content = apiClient.new JacksonJsonHttpContent(earningsTemplate);
Credential credential =
new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken);
HttpTransport transport = apiClient.getHttpTransport();
HttpRequestFactory requestFactory = transport.createRequestFactory(credential);
return requestFactory
.buildRequest(HttpMethods.POST, genericUrl, content)
.setHeaders(headers)
.setConnectTimeout(apiClient.getConnectionTimeout())
.setReadTimeout(apiClient.getReadTimeout())
.execute();
}
/**
* Creates a pay run
*
* 200 - created payrun results
*
*
400 - validation error for a bad request
*
* @param xeroTenantId Xero identifier for Tenant
* @param payRun The payRun parameter
* @param idempotencyKey This allows you to safely retry requests without the risk of duplicate
* processing. 128 character max.
* @param accessToken Authorization token for user set in header of each request
* @return PayRunObject
* @throws IOException if an error occurs while attempting to invoke the API *
*/
public PayRunObject createPayRun(
String accessToken, String xeroTenantId, PayRun payRun, String idempotencyKey)
throws IOException {
try {
TypeReference typeRef = new TypeReference() {};
HttpResponse response =
createPayRunForHttpResponse(accessToken, xeroTenantId, payRun, idempotencyKey);
return apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
} catch (HttpResponseException e) {
if (logger.isDebugEnabled()) {
logger.debug(
"------------------ HttpResponseException "
+ e.getStatusCode()
+ " : createPayRun -------------------");
logger.debug(e.toString());
}
XeroApiExceptionHandler handler = new XeroApiExceptionHandler();
if (e.getStatusCode() == 400 || e.getStatusCode() == 405) {
TypeReference errorTypeRef = new TypeReference() {};
PayRunObject object = apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef);
handler.validationError(e.getStatusCode(), "PayRunObject", object.getProblem(), e);
} else {
handler.execute(e);
}
} catch (IOException ioe) {
throw ioe;
}
return null;
}
/**
* Creates a pay run
*
* 200 - created payrun results
*
*
400 - validation error for a bad request
*
* @param xeroTenantId Xero identifier for Tenant
* @param payRun The payRun parameter
* @param idempotencyKey This allows you to safely retry requests without the risk of duplicate
* processing. 128 character max.
* @param accessToken Authorization token for user set in header of each request
* @return HttpResponse
* @throws IOException if an error occurs while attempting to invoke the API
*/
public HttpResponse createPayRunForHttpResponse(
String accessToken, String xeroTenantId, PayRun payRun, String idempotencyKey)
throws IOException {
// verify the required parameter 'xeroTenantId' is set
if (xeroTenantId == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'xeroTenantId' when calling createPayRun");
} // verify the required parameter 'payRun' is set
if (payRun == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'payRun' when calling createPayRun");
}
if (accessToken == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'accessToken' when calling createPayRun");
}
HttpHeaders headers = new HttpHeaders();
headers.set("Xero-Tenant-Id", xeroTenantId);
headers.set("Idempotency-Key", idempotencyKey);
headers.setAccept("application/json");
headers.setContentType("application/json");
headers.setUserAgent(this.getUserAgent());
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PayRuns");
String url = uriBuilder.build().toString();
GenericUrl genericUrl = new GenericUrl(url);
if (logger.isDebugEnabled()) {
logger.debug("POST " + genericUrl.toString());
}
HttpContent content = null;
content = apiClient.new JacksonJsonHttpContent(payRun);
Credential credential =
new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken);
HttpTransport transport = apiClient.getHttpTransport();
HttpRequestFactory requestFactory = transport.createRequestFactory(credential);
return requestFactory
.buildRequest(HttpMethods.POST, genericUrl, content)
.setHeaders(headers)
.setConnectTimeout(apiClient.getConnectionTimeout())
.setReadTimeout(apiClient.getReadTimeout())
.execute();
}
/**
* Creates a new payrun calendar
*
*
200 - search results matching criteria
*
*
400 - validation error for a bad request
*
* @param xeroTenantId Xero identifier for Tenant
* @param payRunCalendar The payRunCalendar parameter
* @param idempotencyKey This allows you to safely retry requests without the risk of duplicate
* processing. 128 character max.
* @param accessToken Authorization token for user set in header of each request
* @return PayRunCalendarObject
* @throws IOException if an error occurs while attempting to invoke the API *
*/
public PayRunCalendarObject createPayRunCalendar(
String accessToken, String xeroTenantId, PayRunCalendar payRunCalendar, String idempotencyKey)
throws IOException {
try {
TypeReference typeRef = new TypeReference() {};
HttpResponse response =
createPayRunCalendarForHttpResponse(
accessToken, xeroTenantId, payRunCalendar, idempotencyKey);
return apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
} catch (HttpResponseException e) {
if (logger.isDebugEnabled()) {
logger.debug(
"------------------ HttpResponseException "
+ e.getStatusCode()
+ " : createPayRunCalendar -------------------");
logger.debug(e.toString());
}
XeroApiExceptionHandler handler = new XeroApiExceptionHandler();
if (e.getStatusCode() == 400 || e.getStatusCode() == 405) {
TypeReference errorTypeRef =
new TypeReference() {};
PayRunCalendarObject object =
apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef);
handler.validationError(e.getStatusCode(), "PayRunCalendarObject", object.getProblem(), e);
} else {
handler.execute(e);
}
} catch (IOException ioe) {
throw ioe;
}
return null;
}
/**
* Creates a new payrun calendar
*
* 200 - search results matching criteria
*
*
400 - validation error for a bad request
*
* @param xeroTenantId Xero identifier for Tenant
* @param payRunCalendar The payRunCalendar parameter
* @param idempotencyKey This allows you to safely retry requests without the risk of duplicate
* processing. 128 character max.
* @param accessToken Authorization token for user set in header of each request
* @return HttpResponse
* @throws IOException if an error occurs while attempting to invoke the API
*/
public HttpResponse createPayRunCalendarForHttpResponse(
String accessToken, String xeroTenantId, PayRunCalendar payRunCalendar, String idempotencyKey)
throws IOException {
// verify the required parameter 'xeroTenantId' is set
if (xeroTenantId == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'xeroTenantId' when calling createPayRunCalendar");
} // verify the required parameter 'payRunCalendar' is set
if (payRunCalendar == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'payRunCalendar' when calling createPayRunCalendar");
}
if (accessToken == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'accessToken' when calling createPayRunCalendar");
}
HttpHeaders headers = new HttpHeaders();
headers.set("Xero-Tenant-Id", xeroTenantId);
headers.set("Idempotency-Key", idempotencyKey);
headers.setAccept("application/json");
headers.setContentType("application/json");
headers.setUserAgent(this.getUserAgent());
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PayRunCalendars");
String url = uriBuilder.build().toString();
GenericUrl genericUrl = new GenericUrl(url);
if (logger.isDebugEnabled()) {
logger.debug("POST " + genericUrl.toString());
}
HttpContent content = null;
content = apiClient.new JacksonJsonHttpContent(payRunCalendar);
Credential credential =
new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken);
HttpTransport transport = apiClient.getHttpTransport();
HttpRequestFactory requestFactory = transport.createRequestFactory(credential);
return requestFactory
.buildRequest(HttpMethods.POST, genericUrl, content)
.setHeaders(headers)
.setConnectTimeout(apiClient.getConnectionTimeout())
.setReadTimeout(apiClient.getReadTimeout())
.execute();
}
/**
* Creates a new reimbursement
*
*
200 - search results matching criteria
*
*
400 - validation error for a bad request
*
* @param xeroTenantId Xero identifier for Tenant
* @param reimbursement The reimbursement parameter
* @param idempotencyKey This allows you to safely retry requests without the risk of duplicate
* processing. 128 character max.
* @param accessToken Authorization token for user set in header of each request
* @return ReimbursementObject
* @throws IOException if an error occurs while attempting to invoke the API *
*/
public ReimbursementObject createReimbursement(
String accessToken, String xeroTenantId, Reimbursement reimbursement, String idempotencyKey)
throws IOException {
try {
TypeReference typeRef = new TypeReference() {};
HttpResponse response =
createReimbursementForHttpResponse(
accessToken, xeroTenantId, reimbursement, idempotencyKey);
return apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
} catch (HttpResponseException e) {
if (logger.isDebugEnabled()) {
logger.debug(
"------------------ HttpResponseException "
+ e.getStatusCode()
+ " : createReimbursement -------------------");
logger.debug(e.toString());
}
XeroApiExceptionHandler handler = new XeroApiExceptionHandler();
if (e.getStatusCode() == 400 || e.getStatusCode() == 405) {
TypeReference errorTypeRef =
new TypeReference() {};
ReimbursementObject object =
apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef);
handler.validationError(e.getStatusCode(), "ReimbursementObject", object.getProblem(), e);
} else {
handler.execute(e);
}
} catch (IOException ioe) {
throw ioe;
}
return null;
}
/**
* Creates a new reimbursement
*
* 200 - search results matching criteria
*
*
400 - validation error for a bad request
*
* @param xeroTenantId Xero identifier for Tenant
* @param reimbursement The reimbursement parameter
* @param idempotencyKey This allows you to safely retry requests without the risk of duplicate
* processing. 128 character max.
* @param accessToken Authorization token for user set in header of each request
* @return HttpResponse
* @throws IOException if an error occurs while attempting to invoke the API
*/
public HttpResponse createReimbursementForHttpResponse(
String accessToken, String xeroTenantId, Reimbursement reimbursement, String idempotencyKey)
throws IOException {
// verify the required parameter 'xeroTenantId' is set
if (xeroTenantId == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'xeroTenantId' when calling createReimbursement");
} // verify the required parameter 'reimbursement' is set
if (reimbursement == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'reimbursement' when calling createReimbursement");
}
if (accessToken == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'accessToken' when calling createReimbursement");
}
HttpHeaders headers = new HttpHeaders();
headers.set("Xero-Tenant-Id", xeroTenantId);
headers.set("Idempotency-Key", idempotencyKey);
headers.setAccept("application/json");
headers.setContentType("application/json");
headers.setUserAgent(this.getUserAgent());
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reimbursements");
String url = uriBuilder.build().toString();
GenericUrl genericUrl = new GenericUrl(url);
if (logger.isDebugEnabled()) {
logger.debug("POST " + genericUrl.toString());
}
HttpContent content = null;
content = apiClient.new JacksonJsonHttpContent(reimbursement);
Credential credential =
new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken);
HttpTransport transport = apiClient.getHttpTransport();
HttpRequestFactory requestFactory = transport.createRequestFactory(credential);
return requestFactory
.buildRequest(HttpMethods.POST, genericUrl, content)
.setHeaders(headers)
.setConnectTimeout(apiClient.getConnectionTimeout())
.setReadTimeout(apiClient.getReadTimeout())
.execute();
}
/**
* Creates a new superannuation
*
*
200 - search results matching criteria
*
*
400 - validation error for a bad request
*
* @param xeroTenantId Xero identifier for Tenant
* @param benefit The benefit parameter
* @param idempotencyKey This allows you to safely retry requests without the risk of duplicate
* processing. 128 character max.
* @param accessToken Authorization token for user set in header of each request
* @return SuperannuationObject
* @throws IOException if an error occurs while attempting to invoke the API *
*/
public SuperannuationObject createSuperannuation(
String accessToken, String xeroTenantId, Benefit benefit, String idempotencyKey)
throws IOException {
try {
TypeReference typeRef = new TypeReference() {};
HttpResponse response =
createSuperannuationForHttpResponse(accessToken, xeroTenantId, benefit, idempotencyKey);
return apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
} catch (HttpResponseException e) {
if (logger.isDebugEnabled()) {
logger.debug(
"------------------ HttpResponseException "
+ e.getStatusCode()
+ " : createSuperannuation -------------------");
logger.debug(e.toString());
}
XeroApiExceptionHandler handler = new XeroApiExceptionHandler();
if (e.getStatusCode() == 400 || e.getStatusCode() == 405) {
TypeReference errorTypeRef =
new TypeReference() {};
SuperannuationObject object =
apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef);
handler.validationError(e.getStatusCode(), "SuperannuationObject", object.getProblem(), e);
} else {
handler.execute(e);
}
} catch (IOException ioe) {
throw ioe;
}
return null;
}
/**
* Creates a new superannuation
*
* 200 - search results matching criteria
*
*
400 - validation error for a bad request
*
* @param xeroTenantId Xero identifier for Tenant
* @param benefit The benefit parameter
* @param idempotencyKey This allows you to safely retry requests without the risk of duplicate
* processing. 128 character max.
* @param accessToken Authorization token for user set in header of each request
* @return HttpResponse
* @throws IOException if an error occurs while attempting to invoke the API
*/
public HttpResponse createSuperannuationForHttpResponse(
String accessToken, String xeroTenantId, Benefit benefit, String idempotencyKey)
throws IOException {
// verify the required parameter 'xeroTenantId' is set
if (xeroTenantId == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'xeroTenantId' when calling createSuperannuation");
} // verify the required parameter 'benefit' is set
if (benefit == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'benefit' when calling createSuperannuation");
}
if (accessToken == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'accessToken' when calling createSuperannuation");
}
HttpHeaders headers = new HttpHeaders();
headers.set("Xero-Tenant-Id", xeroTenantId);
headers.set("Idempotency-Key", idempotencyKey);
headers.setAccept("application/json");
headers.setContentType("application/json");
headers.setUserAgent(this.getUserAgent());
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Superannuations");
String url = uriBuilder.build().toString();
GenericUrl genericUrl = new GenericUrl(url);
if (logger.isDebugEnabled()) {
logger.debug("POST " + genericUrl.toString());
}
HttpContent content = null;
content = apiClient.new JacksonJsonHttpContent(benefit);
Credential credential =
new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken);
HttpTransport transport = apiClient.getHttpTransport();
HttpRequestFactory requestFactory = transport.createRequestFactory(credential);
return requestFactory
.buildRequest(HttpMethods.POST, genericUrl, content)
.setHeaders(headers)
.setConnectTimeout(apiClient.getConnectionTimeout())
.setReadTimeout(apiClient.getReadTimeout())
.execute();
}
/**
* Creates a new timesheet
*
*
200 - search results matching criteria
*
*
400 - validation error for a bad request
*
* @param xeroTenantId Xero identifier for Tenant
* @param timesheet The timesheet parameter
* @param idempotencyKey This allows you to safely retry requests without the risk of duplicate
* processing. 128 character max.
* @param accessToken Authorization token for user set in header of each request
* @return TimesheetObject
* @throws IOException if an error occurs while attempting to invoke the API *
*/
public TimesheetObject createTimesheet(
String accessToken, String xeroTenantId, Timesheet timesheet, String idempotencyKey)
throws IOException {
try {
TypeReference typeRef = new TypeReference() {};
HttpResponse response =
createTimesheetForHttpResponse(accessToken, xeroTenantId, timesheet, idempotencyKey);
return apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
} catch (HttpResponseException e) {
if (logger.isDebugEnabled()) {
logger.debug(
"------------------ HttpResponseException "
+ e.getStatusCode()
+ " : createTimesheet -------------------");
logger.debug(e.toString());
}
XeroApiExceptionHandler handler = new XeroApiExceptionHandler();
if (e.getStatusCode() == 400 || e.getStatusCode() == 405) {
TypeReference errorTypeRef = new TypeReference() {};
TimesheetObject object =
apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef);
handler.validationError(e.getStatusCode(), "TimesheetObject", object.getProblem(), e);
} else {
handler.execute(e);
}
} catch (IOException ioe) {
throw ioe;
}
return null;
}
/**
* Creates a new timesheet
*
* 200 - search results matching criteria
*
*
400 - validation error for a bad request
*
* @param xeroTenantId Xero identifier for Tenant
* @param timesheet The timesheet parameter
* @param idempotencyKey This allows you to safely retry requests without the risk of duplicate
* processing. 128 character max.
* @param accessToken Authorization token for user set in header of each request
* @return HttpResponse
* @throws IOException if an error occurs while attempting to invoke the API
*/
public HttpResponse createTimesheetForHttpResponse(
String accessToken, String xeroTenantId, Timesheet timesheet, String idempotencyKey)
throws IOException {
// verify the required parameter 'xeroTenantId' is set
if (xeroTenantId == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'xeroTenantId' when calling createTimesheet");
} // verify the required parameter 'timesheet' is set
if (timesheet == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'timesheet' when calling createTimesheet");
}
if (accessToken == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'accessToken' when calling createTimesheet");
}
HttpHeaders headers = new HttpHeaders();
headers.set("Xero-Tenant-Id", xeroTenantId);
headers.set("Idempotency-Key", idempotencyKey);
headers.setAccept("application/json");
headers.setContentType("application/json");
headers.setUserAgent(this.getUserAgent());
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Timesheets");
String url = uriBuilder.build().toString();
GenericUrl genericUrl = new GenericUrl(url);
if (logger.isDebugEnabled()) {
logger.debug("POST " + genericUrl.toString());
}
HttpContent content = null;
content = apiClient.new JacksonJsonHttpContent(timesheet);
Credential credential =
new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken);
HttpTransport transport = apiClient.getHttpTransport();
HttpRequestFactory requestFactory = transport.createRequestFactory(credential);
return requestFactory
.buildRequest(HttpMethods.POST, genericUrl, content)
.setHeaders(headers)
.setConnectTimeout(apiClient.getConnectionTimeout())
.setReadTimeout(apiClient.getReadTimeout())
.execute();
}
/**
* Create a new timesheet line for a specific time sheet
*
*
200 - search results matching criteria
*
*
400 - validation error for a bad request
*
* @param xeroTenantId Xero identifier for Tenant
* @param timesheetID Identifier for the timesheet
* @param timesheetLine The timesheetLine parameter
* @param idempotencyKey This allows you to safely retry requests without the risk of duplicate
* processing. 128 character max.
* @param accessToken Authorization token for user set in header of each request
* @return TimesheetLineObject
* @throws IOException if an error occurs while attempting to invoke the API *
*/
public TimesheetLineObject createTimesheetLine(
String accessToken,
String xeroTenantId,
UUID timesheetID,
TimesheetLine timesheetLine,
String idempotencyKey)
throws IOException {
try {
TypeReference typeRef = new TypeReference() {};
HttpResponse response =
createTimesheetLineForHttpResponse(
accessToken, xeroTenantId, timesheetID, timesheetLine, idempotencyKey);
return apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
} catch (HttpResponseException e) {
if (logger.isDebugEnabled()) {
logger.debug(
"------------------ HttpResponseException "
+ e.getStatusCode()
+ " : createTimesheetLine -------------------");
logger.debug(e.toString());
}
XeroApiExceptionHandler handler = new XeroApiExceptionHandler();
if (e.getStatusCode() == 400 || e.getStatusCode() == 405) {
TypeReference errorTypeRef =
new TypeReference() {};
TimesheetLineObject object =
apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef);
handler.validationError(e.getStatusCode(), "TimesheetLineObject", object.getProblem(), e);
} else {
handler.execute(e);
}
} catch (IOException ioe) {
throw ioe;
}
return null;
}
/**
* Create a new timesheet line for a specific time sheet
*
* 200 - search results matching criteria
*
*
400 - validation error for a bad request
*
* @param xeroTenantId Xero identifier for Tenant
* @param timesheetID Identifier for the timesheet
* @param timesheetLine The timesheetLine parameter
* @param idempotencyKey This allows you to safely retry requests without the risk of duplicate
* processing. 128 character max.
* @param accessToken Authorization token for user set in header of each request
* @return HttpResponse
* @throws IOException if an error occurs while attempting to invoke the API
*/
public HttpResponse createTimesheetLineForHttpResponse(
String accessToken,
String xeroTenantId,
UUID timesheetID,
TimesheetLine timesheetLine,
String idempotencyKey)
throws IOException {
// verify the required parameter 'xeroTenantId' is set
if (xeroTenantId == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'xeroTenantId' when calling createTimesheetLine");
} // verify the required parameter 'timesheetID' is set
if (timesheetID == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'timesheetID' when calling createTimesheetLine");
} // verify the required parameter 'timesheetLine' is set
if (timesheetLine == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'timesheetLine' when calling createTimesheetLine");
}
if (accessToken == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'accessToken' when calling createTimesheetLine");
}
HttpHeaders headers = new HttpHeaders();
headers.set("Xero-Tenant-Id", xeroTenantId);
headers.set("Idempotency-Key", idempotencyKey);
headers.setAccept("application/json");
headers.setContentType("application/json");
headers.setUserAgent(this.getUserAgent());
// create a map of path variables
final Map uriVariables = new HashMap();
uriVariables.put("TimesheetID", timesheetID);
UriBuilder uriBuilder =
UriBuilder.fromUri(apiClient.getBasePath() + "/Timesheets/{TimesheetID}/Lines");
String url = uriBuilder.buildFromMap(uriVariables).toString();
GenericUrl genericUrl = new GenericUrl(url);
if (logger.isDebugEnabled()) {
logger.debug("POST " + genericUrl.toString());
}
HttpContent content = null;
content = apiClient.new JacksonJsonHttpContent(timesheetLine);
Credential credential =
new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken);
HttpTransport transport = apiClient.getHttpTransport();
HttpRequestFactory requestFactory = transport.createRequestFactory(credential);
return requestFactory
.buildRequest(HttpMethods.POST, genericUrl, content)
.setHeaders(headers)
.setConnectTimeout(apiClient.getConnectionTimeout())
.setReadTimeout(apiClient.getReadTimeout())
.execute();
}
/**
* Deletes an employee's earnings template record
*
* 200 - deletion successful
*
* @param xeroTenantId Xero identifier for Tenant
* @param employeeID Employee id for single object
* @param payTemplateEarningID Id for single pay template earnings object
* @param accessToken Authorization token for user set in header of each request
* @return EarningsTemplateObject
* @throws IOException if an error occurs while attempting to invoke the API *
*/
public EarningsTemplateObject deleteEmployeeEarningsTemplate(
String accessToken, String xeroTenantId, UUID employeeID, UUID payTemplateEarningID)
throws IOException {
try {
TypeReference typeRef =
new TypeReference() {};
HttpResponse response =
deleteEmployeeEarningsTemplateForHttpResponse(
accessToken, xeroTenantId, employeeID, payTemplateEarningID);
return apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
} catch (HttpResponseException e) {
if (logger.isDebugEnabled()) {
logger.debug(
"------------------ HttpResponseException "
+ e.getStatusCode()
+ " : deleteEmployeeEarningsTemplate -------------------");
logger.debug(e.toString());
}
XeroApiExceptionHandler handler = new XeroApiExceptionHandler();
handler.execute(e);
} catch (IOException ioe) {
throw ioe;
}
return null;
}
/**
* Deletes an employee's earnings template record
*
* 200 - deletion successful
*
* @param xeroTenantId Xero identifier for Tenant
* @param employeeID Employee id for single object
* @param payTemplateEarningID Id for single pay template earnings object
* @param accessToken Authorization token for user set in header of each request
* @return HttpResponse
* @throws IOException if an error occurs while attempting to invoke the API
*/
public HttpResponse deleteEmployeeEarningsTemplateForHttpResponse(
String accessToken, String xeroTenantId, UUID employeeID, UUID payTemplateEarningID)
throws IOException {
// verify the required parameter 'xeroTenantId' is set
if (xeroTenantId == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'xeroTenantId' when calling"
+ " deleteEmployeeEarningsTemplate");
} // verify the required parameter 'employeeID' is set
if (employeeID == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'employeeID' when calling"
+ " deleteEmployeeEarningsTemplate");
} // verify the required parameter 'payTemplateEarningID' is set
if (payTemplateEarningID == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'payTemplateEarningID' when calling"
+ " deleteEmployeeEarningsTemplate");
}
if (accessToken == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'accessToken' when calling"
+ " deleteEmployeeEarningsTemplate");
}
HttpHeaders headers = new HttpHeaders();
headers.set("Xero-Tenant-Id", xeroTenantId);
headers.setAccept("application/json");
headers.setUserAgent(this.getUserAgent());
// create a map of path variables
final Map uriVariables = new HashMap();
uriVariables.put("EmployeeID", employeeID);
uriVariables.put("PayTemplateEarningID", payTemplateEarningID);
UriBuilder uriBuilder =
UriBuilder.fromUri(
apiClient.getBasePath()
+ "/Employees/{EmployeeID}/PayTemplates/Earnings/{PayTemplateEarningID}");
String url = uriBuilder.buildFromMap(uriVariables).toString();
GenericUrl genericUrl = new GenericUrl(url);
if (logger.isDebugEnabled()) {
logger.debug("DELETE " + genericUrl.toString());
}
HttpContent content = null;
Credential credential =
new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken);
HttpTransport transport = apiClient.getHttpTransport();
HttpRequestFactory requestFactory = transport.createRequestFactory(credential);
return requestFactory
.buildRequest(HttpMethods.DELETE, genericUrl, content)
.setHeaders(headers)
.setConnectTimeout(apiClient.getConnectionTimeout())
.setReadTimeout(apiClient.getReadTimeout())
.execute();
}
/**
* Deletes a leave record for a specific employee
*
* 200 - successful response
*
* @param xeroTenantId Xero identifier for Tenant
* @param employeeID Employee id for single object
* @param leaveID Leave id for single object
* @param accessToken Authorization token for user set in header of each request
* @return EmployeeLeaveObject
* @throws IOException if an error occurs while attempting to invoke the API *
*/
public EmployeeLeaveObject deleteEmployeeLeave(
String accessToken, String xeroTenantId, UUID employeeID, UUID leaveID) throws IOException {
try {
TypeReference typeRef = new TypeReference() {};
HttpResponse response =
deleteEmployeeLeaveForHttpResponse(accessToken, xeroTenantId, employeeID, leaveID);
return apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
} catch (HttpResponseException e) {
if (logger.isDebugEnabled()) {
logger.debug(
"------------------ HttpResponseException "
+ e.getStatusCode()
+ " : deleteEmployeeLeave -------------------");
logger.debug(e.toString());
}
XeroApiExceptionHandler handler = new XeroApiExceptionHandler();
if (e.getStatusCode() == 400 || e.getStatusCode() == 405) {
TypeReference errorTypeRef =
new TypeReference() {};
EmployeeLeaveObject object =
apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef);
handler.validationError(e.getStatusCode(), "EmployeeLeaveObject", object.getProblem(), e);
} else {
handler.execute(e);
}
} catch (IOException ioe) {
throw ioe;
}
return null;
}
/**
* Deletes a leave record for a specific employee
*
* 200 - successful response
*
* @param xeroTenantId Xero identifier for Tenant
* @param employeeID Employee id for single object
* @param leaveID Leave id for single object
* @param accessToken Authorization token for user set in header of each request
* @return HttpResponse
* @throws IOException if an error occurs while attempting to invoke the API
*/
public HttpResponse deleteEmployeeLeaveForHttpResponse(
String accessToken, String xeroTenantId, UUID employeeID, UUID leaveID) throws IOException {
// verify the required parameter 'xeroTenantId' is set
if (xeroTenantId == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'xeroTenantId' when calling deleteEmployeeLeave");
} // verify the required parameter 'employeeID' is set
if (employeeID == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'employeeID' when calling deleteEmployeeLeave");
} // verify the required parameter 'leaveID' is set
if (leaveID == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'leaveID' when calling deleteEmployeeLeave");
}
if (accessToken == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'accessToken' when calling deleteEmployeeLeave");
}
HttpHeaders headers = new HttpHeaders();
headers.set("Xero-Tenant-Id", xeroTenantId);
headers.setAccept("application/json");
headers.setUserAgent(this.getUserAgent());
// create a map of path variables
final Map uriVariables = new HashMap();
uriVariables.put("EmployeeID", employeeID);
uriVariables.put("LeaveID", leaveID);
UriBuilder uriBuilder =
UriBuilder.fromUri(apiClient.getBasePath() + "/Employees/{EmployeeID}/Leave/{LeaveID}");
String url = uriBuilder.buildFromMap(uriVariables).toString();
GenericUrl genericUrl = new GenericUrl(url);
if (logger.isDebugEnabled()) {
logger.debug("DELETE " + genericUrl.toString());
}
HttpContent content = null;
Credential credential =
new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken);
HttpTransport transport = apiClient.getHttpTransport();
HttpRequestFactory requestFactory = transport.createRequestFactory(credential);
return requestFactory
.buildRequest(HttpMethods.DELETE, genericUrl, content)
.setHeaders(headers)
.setConnectTimeout(apiClient.getConnectionTimeout())
.setReadTimeout(apiClient.getReadTimeout())
.execute();
}
/**
* Deletes an employee's salary and wages record
*
* 200 - deletion successful
*
* @param xeroTenantId Xero identifier for Tenant
* @param employeeID Employee id for single object
* @param salaryAndWagesID Id for single salary and wages object
* @param accessToken Authorization token for user set in header of each request
* @return SalaryAndWageObject
* @throws IOException if an error occurs while attempting to invoke the API *
*/
public SalaryAndWageObject deleteEmployeeSalaryAndWage(
String accessToken, String xeroTenantId, UUID employeeID, UUID salaryAndWagesID)
throws IOException {
try {
TypeReference typeRef = new TypeReference() {};
HttpResponse response =
deleteEmployeeSalaryAndWageForHttpResponse(
accessToken, xeroTenantId, employeeID, salaryAndWagesID);
return apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
} catch (HttpResponseException e) {
if (logger.isDebugEnabled()) {
logger.debug(
"------------------ HttpResponseException "
+ e.getStatusCode()
+ " : deleteEmployeeSalaryAndWage -------------------");
logger.debug(e.toString());
}
XeroApiExceptionHandler handler = new XeroApiExceptionHandler();
handler.execute(e);
} catch (IOException ioe) {
throw ioe;
}
return null;
}
/**
* Deletes an employee's salary and wages record
*
* 200 - deletion successful
*
* @param xeroTenantId Xero identifier for Tenant
* @param employeeID Employee id for single object
* @param salaryAndWagesID Id for single salary and wages object
* @param accessToken Authorization token for user set in header of each request
* @return HttpResponse
* @throws IOException if an error occurs while attempting to invoke the API
*/
public HttpResponse deleteEmployeeSalaryAndWageForHttpResponse(
String accessToken, String xeroTenantId, UUID employeeID, UUID salaryAndWagesID)
throws IOException {
// verify the required parameter 'xeroTenantId' is set
if (xeroTenantId == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'xeroTenantId' when calling deleteEmployeeSalaryAndWage");
} // verify the required parameter 'employeeID' is set
if (employeeID == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'employeeID' when calling deleteEmployeeSalaryAndWage");
} // verify the required parameter 'salaryAndWagesID' is set
if (salaryAndWagesID == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'salaryAndWagesID' when calling"
+ " deleteEmployeeSalaryAndWage");
}
if (accessToken == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'accessToken' when calling deleteEmployeeSalaryAndWage");
}
HttpHeaders headers = new HttpHeaders();
headers.set("Xero-Tenant-Id", xeroTenantId);
headers.setAccept("application/json");
headers.setUserAgent(this.getUserAgent());
// create a map of path variables
final Map uriVariables = new HashMap();
uriVariables.put("EmployeeID", employeeID);
uriVariables.put("SalaryAndWagesID", salaryAndWagesID);
UriBuilder uriBuilder =
UriBuilder.fromUri(
apiClient.getBasePath() + "/Employees/{EmployeeID}/SalaryAndWages/{SalaryAndWagesID}");
String url = uriBuilder.buildFromMap(uriVariables).toString();
GenericUrl genericUrl = new GenericUrl(url);
if (logger.isDebugEnabled()) {
logger.debug("DELETE " + genericUrl.toString());
}
HttpContent content = null;
Credential credential =
new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken);
HttpTransport transport = apiClient.getHttpTransport();
HttpRequestFactory requestFactory = transport.createRequestFactory(credential);
return requestFactory
.buildRequest(HttpMethods.DELETE, genericUrl, content)
.setHeaders(headers)
.setConnectTimeout(apiClient.getConnectionTimeout())
.setReadTimeout(apiClient.getReadTimeout())
.execute();
}
/**
* deletes employee's working patterns
*
* 200 - successful response
*
*
400 - validation error for a bad request
*
* @param xeroTenantId Xero identifier for Tenant
* @param employeeID Employee id for single object
* @param employeeWorkingPatternID Employee working pattern id for single object
* @param accessToken Authorization token for user set in header of each request
* @return EmployeeLeaveObject
* @throws IOException if an error occurs while attempting to invoke the API *
*/
public EmployeeLeaveObject deleteEmployeeWorkingPattern(
String accessToken, String xeroTenantId, UUID employeeID, UUID employeeWorkingPatternID)
throws IOException {
try {
TypeReference typeRef = new TypeReference() {};
HttpResponse response =
deleteEmployeeWorkingPatternForHttpResponse(
accessToken, xeroTenantId, employeeID, employeeWorkingPatternID);
return apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
} catch (HttpResponseException e) {
if (logger.isDebugEnabled()) {
logger.debug(
"------------------ HttpResponseException "
+ e.getStatusCode()
+ " : deleteEmployeeWorkingPattern -------------------");
logger.debug(e.toString());
}
XeroApiExceptionHandler handler = new XeroApiExceptionHandler();
if (e.getStatusCode() == 400 || e.getStatusCode() == 405) {
TypeReference errorTypeRef =
new TypeReference() {};
EmployeeLeaveObject object =
apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef);
handler.validationError(e.getStatusCode(), "EmployeeLeaveObject", object.getProblem(), e);
} else {
handler.execute(e);
}
} catch (IOException ioe) {
throw ioe;
}
return null;
}
/**
* deletes employee's working patterns
*
* 200 - successful response
*
*
400 - validation error for a bad request
*
* @param xeroTenantId Xero identifier for Tenant
* @param employeeID Employee id for single object
* @param employeeWorkingPatternID Employee working pattern id for single object
* @param accessToken Authorization token for user set in header of each request
* @return HttpResponse
* @throws IOException if an error occurs while attempting to invoke the API
*/
public HttpResponse deleteEmployeeWorkingPatternForHttpResponse(
String accessToken, String xeroTenantId, UUID employeeID, UUID employeeWorkingPatternID)
throws IOException {
// verify the required parameter 'xeroTenantId' is set
if (xeroTenantId == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'xeroTenantId' when calling"
+ " deleteEmployeeWorkingPattern");
} // verify the required parameter 'employeeID' is set
if (employeeID == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'employeeID' when calling deleteEmployeeWorkingPattern");
} // verify the required parameter 'employeeWorkingPatternID' is set
if (employeeWorkingPatternID == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'employeeWorkingPatternID' when calling"
+ " deleteEmployeeWorkingPattern");
}
if (accessToken == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'accessToken' when calling deleteEmployeeWorkingPattern");
}
HttpHeaders headers = new HttpHeaders();
headers.set("Xero-Tenant-Id", xeroTenantId);
headers.setAccept("application/json");
headers.setUserAgent(this.getUserAgent());
// create a map of path variables
final Map uriVariables = new HashMap();
uriVariables.put("EmployeeID", employeeID);
uriVariables.put("EmployeeWorkingPatternID", employeeWorkingPatternID);
UriBuilder uriBuilder =
UriBuilder.fromUri(
apiClient.getBasePath()
+ "/Employees/{EmployeeID}/Working-Patterns/{EmployeeWorkingPatternID}");
String url = uriBuilder.buildFromMap(uriVariables).toString();
GenericUrl genericUrl = new GenericUrl(url);
if (logger.isDebugEnabled()) {
logger.debug("DELETE " + genericUrl.toString());
}
HttpContent content = null;
Credential credential =
new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken);
HttpTransport transport = apiClient.getHttpTransport();
HttpRequestFactory requestFactory = transport.createRequestFactory(credential);
return requestFactory
.buildRequest(HttpMethods.DELETE, genericUrl, content)
.setHeaders(headers)
.setConnectTimeout(apiClient.getConnectionTimeout())
.setReadTimeout(apiClient.getReadTimeout())
.execute();
}
/**
* Deletes a timesheet
*
* 200 - search results matching criteria
*
*
400 - validation error for a bad request
*
* @param xeroTenantId Xero identifier for Tenant
* @param timesheetID Identifier for the timesheet
* @param accessToken Authorization token for user set in header of each request
* @return TimesheetLine
* @throws IOException if an error occurs while attempting to invoke the API *
*/
public TimesheetLine deleteTimesheet(String accessToken, String xeroTenantId, UUID timesheetID)
throws IOException {
try {
TypeReference typeRef = new TypeReference() {};
HttpResponse response =
deleteTimesheetForHttpResponse(accessToken, xeroTenantId, timesheetID);
return apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
} catch (HttpResponseException e) {
if (logger.isDebugEnabled()) {
logger.debug(
"------------------ HttpResponseException "
+ e.getStatusCode()
+ " : deleteTimesheet -------------------");
logger.debug(e.toString());
}
XeroApiExceptionHandler handler = new XeroApiExceptionHandler();
handler.execute(e);
} catch (IOException ioe) {
throw ioe;
}
return null;
}
/**
* Deletes a timesheet
*
* 200 - search results matching criteria
*
*
400 - validation error for a bad request
*
* @param xeroTenantId Xero identifier for Tenant
* @param timesheetID Identifier for the timesheet
* @param accessToken Authorization token for user set in header of each request
* @return HttpResponse
* @throws IOException if an error occurs while attempting to invoke the API
*/
public HttpResponse deleteTimesheetForHttpResponse(
String accessToken, String xeroTenantId, UUID timesheetID) throws IOException {
// verify the required parameter 'xeroTenantId' is set
if (xeroTenantId == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'xeroTenantId' when calling deleteTimesheet");
} // verify the required parameter 'timesheetID' is set
if (timesheetID == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'timesheetID' when calling deleteTimesheet");
}
if (accessToken == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'accessToken' when calling deleteTimesheet");
}
HttpHeaders headers = new HttpHeaders();
headers.set("Xero-Tenant-Id", xeroTenantId);
headers.setAccept("application/json");
headers.setUserAgent(this.getUserAgent());
// create a map of path variables
final Map uriVariables = new HashMap();
uriVariables.put("TimesheetID", timesheetID);
UriBuilder uriBuilder =
UriBuilder.fromUri(apiClient.getBasePath() + "/Timesheets/{TimesheetID}");
String url = uriBuilder.buildFromMap(uriVariables).toString();
GenericUrl genericUrl = new GenericUrl(url);
if (logger.isDebugEnabled()) {
logger.debug("DELETE " + genericUrl.toString());
}
HttpContent content = null;
Credential credential =
new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken);
HttpTransport transport = apiClient.getHttpTransport();
HttpRequestFactory requestFactory = transport.createRequestFactory(credential);
return requestFactory
.buildRequest(HttpMethods.DELETE, genericUrl, content)
.setHeaders(headers)
.setConnectTimeout(apiClient.getConnectionTimeout())
.setReadTimeout(apiClient.getReadTimeout())
.execute();
}
/**
* Deletes a timesheet line for a specific timesheet
*
* 200 - search results matching criteria
*
*
400 - validation error for a bad request
*
* @param xeroTenantId Xero identifier for Tenant
* @param timesheetID Identifier for the timesheet
* @param timesheetLineID Identifier for the timesheet line
* @param accessToken Authorization token for user set in header of each request
* @return TimesheetLine
* @throws IOException if an error occurs while attempting to invoke the API *
*/
public TimesheetLine deleteTimesheetLine(
String accessToken, String xeroTenantId, UUID timesheetID, UUID timesheetLineID)
throws IOException {
try {
TypeReference typeRef = new TypeReference() {};
HttpResponse response =
deleteTimesheetLineForHttpResponse(
accessToken, xeroTenantId, timesheetID, timesheetLineID);
return apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
} catch (HttpResponseException e) {
if (logger.isDebugEnabled()) {
logger.debug(
"------------------ HttpResponseException "
+ e.getStatusCode()
+ " : deleteTimesheetLine -------------------");
logger.debug(e.toString());
}
XeroApiExceptionHandler handler = new XeroApiExceptionHandler();
handler.execute(e);
} catch (IOException ioe) {
throw ioe;
}
return null;
}
/**
* Deletes a timesheet line for a specific timesheet
*
* 200 - search results matching criteria
*
*
400 - validation error for a bad request
*
* @param xeroTenantId Xero identifier for Tenant
* @param timesheetID Identifier for the timesheet
* @param timesheetLineID Identifier for the timesheet line
* @param accessToken Authorization token for user set in header of each request
* @return HttpResponse
* @throws IOException if an error occurs while attempting to invoke the API
*/
public HttpResponse deleteTimesheetLineForHttpResponse(
String accessToken, String xeroTenantId, UUID timesheetID, UUID timesheetLineID)
throws IOException {
// verify the required parameter 'xeroTenantId' is set
if (xeroTenantId == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'xeroTenantId' when calling deleteTimesheetLine");
} // verify the required parameter 'timesheetID' is set
if (timesheetID == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'timesheetID' when calling deleteTimesheetLine");
} // verify the required parameter 'timesheetLineID' is set
if (timesheetLineID == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'timesheetLineID' when calling deleteTimesheetLine");
}
if (accessToken == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'accessToken' when calling deleteTimesheetLine");
}
HttpHeaders headers = new HttpHeaders();
headers.set("Xero-Tenant-Id", xeroTenantId);
headers.setAccept("application/json");
headers.setUserAgent(this.getUserAgent());
// create a map of path variables
final Map uriVariables = new HashMap();
uriVariables.put("TimesheetID", timesheetID);
uriVariables.put("TimesheetLineID", timesheetLineID);
UriBuilder uriBuilder =
UriBuilder.fromUri(
apiClient.getBasePath() + "/Timesheets/{TimesheetID}/Lines/{TimesheetLineID}");
String url = uriBuilder.buildFromMap(uriVariables).toString();
GenericUrl genericUrl = new GenericUrl(url);
if (logger.isDebugEnabled()) {
logger.debug("DELETE " + genericUrl.toString());
}
HttpContent content = null;
Credential credential =
new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken);
HttpTransport transport = apiClient.getHttpTransport();
HttpRequestFactory requestFactory = transport.createRequestFactory(credential);
return requestFactory
.buildRequest(HttpMethods.DELETE, genericUrl, content)
.setHeaders(headers)
.setConnectTimeout(apiClient.getConnectionTimeout())
.setReadTimeout(apiClient.getReadTimeout())
.execute();
}
/**
* Retrieves a single deduction by using a unique deduction ID
*
* 200 - search results matching criteria
*
* @param xeroTenantId Xero identifier for Tenant
* @param deductionId Identifier for the deduction
* @param accessToken Authorization token for user set in header of each request
* @return DeductionObject
* @throws IOException if an error occurs while attempting to invoke the API *
*/
public DeductionObject getDeduction(String accessToken, String xeroTenantId, UUID deductionId)
throws IOException {
try {
TypeReference typeRef = new TypeReference() {};
HttpResponse response = getDeductionForHttpResponse(accessToken, xeroTenantId, deductionId);
return apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
} catch (HttpResponseException e) {
if (logger.isDebugEnabled()) {
logger.debug(
"------------------ HttpResponseException "
+ e.getStatusCode()
+ " : getDeduction -------------------");
logger.debug(e.toString());
}
XeroApiExceptionHandler handler = new XeroApiExceptionHandler();
if (e.getStatusCode() == 400 || e.getStatusCode() == 405) {
TypeReference errorTypeRef = new TypeReference() {};
DeductionObject object =
apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef);
handler.validationError(e.getStatusCode(), "DeductionObject", object.getProblem(), e);
} else {
handler.execute(e);
}
} catch (IOException ioe) {
throw ioe;
}
return null;
}
/**
* Retrieves a single deduction by using a unique deduction ID
*
* 200 - search results matching criteria
*
* @param xeroTenantId Xero identifier for Tenant
* @param deductionId Identifier for the deduction
* @param accessToken Authorization token for user set in header of each request
* @return HttpResponse
* @throws IOException if an error occurs while attempting to invoke the API
*/
public HttpResponse getDeductionForHttpResponse(
String accessToken, String xeroTenantId, UUID deductionId) throws IOException {
// verify the required parameter 'xeroTenantId' is set
if (xeroTenantId == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'xeroTenantId' when calling getDeduction");
} // verify the required parameter 'deductionId' is set
if (deductionId == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'deductionId' when calling getDeduction");
}
if (accessToken == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'accessToken' when calling getDeduction");
}
HttpHeaders headers = new HttpHeaders();
headers.set("Xero-Tenant-Id", xeroTenantId);
headers.setAccept("application/json");
headers.setUserAgent(this.getUserAgent());
// create a map of path variables
final Map uriVariables = new HashMap();
uriVariables.put("deductionId", deductionId);
UriBuilder uriBuilder =
UriBuilder.fromUri(apiClient.getBasePath() + "/Deductions/{deductionId}");
String url = uriBuilder.buildFromMap(uriVariables).toString();
GenericUrl genericUrl = new GenericUrl(url);
if (logger.isDebugEnabled()) {
logger.debug("GET " + genericUrl.toString());
}
HttpContent content = null;
Credential credential =
new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken);
HttpTransport transport = apiClient.getHttpTransport();
HttpRequestFactory requestFactory = transport.createRequestFactory(credential);
return requestFactory
.buildRequest(HttpMethods.GET, genericUrl, content)
.setHeaders(headers)
.setConnectTimeout(apiClient.getConnectionTimeout())
.setReadTimeout(apiClient.getReadTimeout())
.execute();
}
/**
* Retrieves deductions for a specific employee
*
* 200 - search results matching criteria
*
* @param xeroTenantId Xero identifier for Tenant
* @param page Page number which specifies the set of records to retrieve. By default the number
* of the records per set is 100.
* @param accessToken Authorization token for user set in header of each request
* @return Deductions
* @throws IOException if an error occurs while attempting to invoke the API *
*/
public Deductions getDeductions(String accessToken, String xeroTenantId, Integer page)
throws IOException {
try {
TypeReference typeRef = new TypeReference() {};
HttpResponse response = getDeductionsForHttpResponse(accessToken, xeroTenantId, page);
return apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
} catch (HttpResponseException e) {
if (logger.isDebugEnabled()) {
logger.debug(
"------------------ HttpResponseException "
+ e.getStatusCode()
+ " : getDeductions -------------------");
logger.debug(e.toString());
}
XeroApiExceptionHandler handler = new XeroApiExceptionHandler();
if (e.getStatusCode() == 400 || e.getStatusCode() == 405) {
TypeReference errorTypeRef = new TypeReference() {};
Deductions object = apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef);
handler.validationError(e.getStatusCode(), "Deductions", object.getProblem(), e);
} else {
handler.execute(e);
}
} catch (IOException ioe) {
throw ioe;
}
return null;
}
/**
* Retrieves deductions for a specific employee
*
* 200 - search results matching criteria
*
* @param xeroTenantId Xero identifier for Tenant
* @param page Page number which specifies the set of records to retrieve. By default the number
* of the records per set is 100.
* @param accessToken Authorization token for user set in header of each request
* @return HttpResponse
* @throws IOException if an error occurs while attempting to invoke the API
*/
public HttpResponse getDeductionsForHttpResponse(
String accessToken, String xeroTenantId, Integer page) throws IOException {
// verify the required parameter 'xeroTenantId' is set
if (xeroTenantId == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'xeroTenantId' when calling getDeductions");
}
if (accessToken == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'accessToken' when calling getDeductions");
}
HttpHeaders headers = new HttpHeaders();
headers.set("Xero-Tenant-Id", xeroTenantId);
headers.setAccept("application/json");
headers.setUserAgent(this.getUserAgent());
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Deductions");
if (page != null) {
String key = "page";
Object value = page;
if (value instanceof Collection) {
List valueList = new ArrayList<>((Collection) value);
if (!valueList.isEmpty() && valueList.get(0) instanceof UUID) {
List list = new ArrayList();
for (int i = 0; i < valueList.size(); i++) {
list.add(valueList.get(i).toString());
}
uriBuilder = uriBuilder.queryParam(key, String.join(",", list));
} else {
uriBuilder = uriBuilder.queryParam(key, String.join(",", valueList));
}
} else if (value instanceof Object[]) {
uriBuilder = uriBuilder.queryParam(key, (Object[]) value);
} else {
uriBuilder = uriBuilder.queryParam(key, value);
}
}
String url = uriBuilder.build().toString();
GenericUrl genericUrl = new GenericUrl(url);
if (logger.isDebugEnabled()) {
logger.debug("GET " + genericUrl.toString());
}
HttpContent content = null;
Credential credential =
new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken);
HttpTransport transport = apiClient.getHttpTransport();
HttpRequestFactory requestFactory = transport.createRequestFactory(credential);
return requestFactory
.buildRequest(HttpMethods.GET, genericUrl, content)
.setHeaders(headers)
.setConnectTimeout(apiClient.getConnectionTimeout())
.setReadTimeout(apiClient.getReadTimeout())
.execute();
}
/**
* Retrieves a specific earnings rates by using a unique earnings rate id
*
* 200 - search results matching criteria
*
* @param xeroTenantId Xero identifier for Tenant
* @param earningsRateID Identifier for the earnings rate
* @param accessToken Authorization token for user set in header of each request
* @return EarningsRateObject
* @throws IOException if an error occurs while attempting to invoke the API *
*/
public EarningsRateObject getEarningsRate(
String accessToken, String xeroTenantId, UUID earningsRateID) throws IOException {
try {
TypeReference typeRef = new TypeReference() {};
HttpResponse response =
getEarningsRateForHttpResponse(accessToken, xeroTenantId, earningsRateID);
return apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
} catch (HttpResponseException e) {
if (logger.isDebugEnabled()) {
logger.debug(
"------------------ HttpResponseException "
+ e.getStatusCode()
+ " : getEarningsRate -------------------");
logger.debug(e.toString());
}
XeroApiExceptionHandler handler = new XeroApiExceptionHandler();
if (e.getStatusCode() == 400 || e.getStatusCode() == 405) {
TypeReference errorTypeRef = new TypeReference() {};
EarningsRateObject object =
apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef);
handler.validationError(e.getStatusCode(), "EarningsRateObject", object.getProblem(), e);
} else {
handler.execute(e);
}
} catch (IOException ioe) {
throw ioe;
}
return null;
}
/**
* Retrieves a specific earnings rates by using a unique earnings rate id
*
* 200 - search results matching criteria
*
* @param xeroTenantId Xero identifier for Tenant
* @param earningsRateID Identifier for the earnings rate
* @param accessToken Authorization token for user set in header of each request
* @return HttpResponse
* @throws IOException if an error occurs while attempting to invoke the API
*/
public HttpResponse getEarningsRateForHttpResponse(
String accessToken, String xeroTenantId, UUID earningsRateID) throws IOException {
// verify the required parameter 'xeroTenantId' is set
if (xeroTenantId == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'xeroTenantId' when calling getEarningsRate");
} // verify the required parameter 'earningsRateID' is set
if (earningsRateID == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'earningsRateID' when calling getEarningsRate");
}
if (accessToken == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'accessToken' when calling getEarningsRate");
}
HttpHeaders headers = new HttpHeaders();
headers.set("Xero-Tenant-Id", xeroTenantId);
headers.setAccept("application/json");
headers.setUserAgent(this.getUserAgent());
// create a map of path variables
final Map uriVariables = new HashMap();
uriVariables.put("EarningsRateID", earningsRateID);
UriBuilder uriBuilder =
UriBuilder.fromUri(apiClient.getBasePath() + "/EarningsRates/{EarningsRateID}");
String url = uriBuilder.buildFromMap(uriVariables).toString();
GenericUrl genericUrl = new GenericUrl(url);
if (logger.isDebugEnabled()) {
logger.debug("GET " + genericUrl.toString());
}
HttpContent content = null;
Credential credential =
new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken);
HttpTransport transport = apiClient.getHttpTransport();
HttpRequestFactory requestFactory = transport.createRequestFactory(credential);
return requestFactory
.buildRequest(HttpMethods.GET, genericUrl, content)
.setHeaders(headers)
.setConnectTimeout(apiClient.getConnectionTimeout())
.setReadTimeout(apiClient.getReadTimeout())
.execute();
}
/**
* Retrieves earnings rates
*
* 200 - search results matching criteria
*
* @param xeroTenantId Xero identifier for Tenant
* @param page Page number which specifies the set of records to retrieve. By default the number
* of the records per set is 100.
* @param accessToken Authorization token for user set in header of each request
* @return EarningsRates
* @throws IOException if an error occurs while attempting to invoke the API *
*/
public EarningsRates getEarningsRates(String accessToken, String xeroTenantId, Integer page)
throws IOException {
try {
TypeReference typeRef = new TypeReference() {};
HttpResponse response = getEarningsRatesForHttpResponse(accessToken, xeroTenantId, page);
return apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
} catch (HttpResponseException e) {
if (logger.isDebugEnabled()) {
logger.debug(
"------------------ HttpResponseException "
+ e.getStatusCode()
+ " : getEarningsRates -------------------");
logger.debug(e.toString());
}
XeroApiExceptionHandler handler = new XeroApiExceptionHandler();
if (e.getStatusCode() == 400 || e.getStatusCode() == 405) {
TypeReference errorTypeRef = new TypeReference() {};
EarningsRates object = apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef);
handler.validationError(e.getStatusCode(), "EarningsRates", object.getProblem(), e);
} else {
handler.execute(e);
}
} catch (IOException ioe) {
throw ioe;
}
return null;
}
/**
* Retrieves earnings rates
*
* 200 - search results matching criteria
*
* @param xeroTenantId Xero identifier for Tenant
* @param page Page number which specifies the set of records to retrieve. By default the number
* of the records per set is 100.
* @param accessToken Authorization token for user set in header of each request
* @return HttpResponse
* @throws IOException if an error occurs while attempting to invoke the API
*/
public HttpResponse getEarningsRatesForHttpResponse(
String accessToken, String xeroTenantId, Integer page) throws IOException {
// verify the required parameter 'xeroTenantId' is set
if (xeroTenantId == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'xeroTenantId' when calling getEarningsRates");
}
if (accessToken == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'accessToken' when calling getEarningsRates");
}
HttpHeaders headers = new HttpHeaders();
headers.set("Xero-Tenant-Id", xeroTenantId);
headers.setAccept("application/json");
headers.setUserAgent(this.getUserAgent());
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/EarningsRates");
if (page != null) {
String key = "page";
Object value = page;
if (value instanceof Collection) {
List valueList = new ArrayList<>((Collection) value);
if (!valueList.isEmpty() && valueList.get(0) instanceof UUID) {
List list = new ArrayList();
for (int i = 0; i < valueList.size(); i++) {
list.add(valueList.get(i).toString());
}
uriBuilder = uriBuilder.queryParam(key, String.join(",", list));
} else {
uriBuilder = uriBuilder.queryParam(key, String.join(",", valueList));
}
} else if (value instanceof Object[]) {
uriBuilder = uriBuilder.queryParam(key, (Object[]) value);
} else {
uriBuilder = uriBuilder.queryParam(key, value);
}
}
String url = uriBuilder.build().toString();
GenericUrl genericUrl = new GenericUrl(url);
if (logger.isDebugEnabled()) {
logger.debug("GET " + genericUrl.toString());
}
HttpContent content = null;
Credential credential =
new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken);
HttpTransport transport = apiClient.getHttpTransport();
HttpRequestFactory requestFactory = transport.createRequestFactory(credential);
return requestFactory
.buildRequest(HttpMethods.GET, genericUrl, content)
.setHeaders(headers)
.setConnectTimeout(apiClient.getConnectionTimeout())
.setReadTimeout(apiClient.getReadTimeout())
.execute();
}
/**
* Retrieves an employees using a unique employee ID
*
* 200 - search results matching criteria
*
* @param xeroTenantId Xero identifier for Tenant
* @param employeeID Employee id for single object
* @param accessToken Authorization token for user set in header of each request
* @return EmployeeObject
* @throws IOException if an error occurs while attempting to invoke the API *
*/
public EmployeeObject getEmployee(String accessToken, String xeroTenantId, UUID employeeID)
throws IOException {
try {
TypeReference typeRef = new TypeReference() {};
HttpResponse response = getEmployeeForHttpResponse(accessToken, xeroTenantId, employeeID);
return apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
} catch (HttpResponseException e) {
if (logger.isDebugEnabled()) {
logger.debug(
"------------------ HttpResponseException "
+ e.getStatusCode()
+ " : getEmployee -------------------");
logger.debug(e.toString());
}
XeroApiExceptionHandler handler = new XeroApiExceptionHandler();
if (e.getStatusCode() == 400 || e.getStatusCode() == 405) {
TypeReference errorTypeRef = new TypeReference() {};
EmployeeObject object = apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef);
handler.validationError(e.getStatusCode(), "EmployeeObject", object.getProblem(), e);
} else {
handler.execute(e);
}
} catch (IOException ioe) {
throw ioe;
}
return null;
}
/**
* Retrieves an employees using a unique employee ID
*
* 200 - search results matching criteria
*
* @param xeroTenantId Xero identifier for Tenant
* @param employeeID Employee id for single object
* @param accessToken Authorization token for user set in header of each request
* @return HttpResponse
* @throws IOException if an error occurs while attempting to invoke the API
*/
public HttpResponse getEmployeeForHttpResponse(
String accessToken, String xeroTenantId, UUID employeeID) throws IOException {
// verify the required parameter 'xeroTenantId' is set
if (xeroTenantId == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'xeroTenantId' when calling getEmployee");
} // verify the required parameter 'employeeID' is set
if (employeeID == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'employeeID' when calling getEmployee");
}
if (accessToken == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'accessToken' when calling getEmployee");
}
HttpHeaders headers = new HttpHeaders();
headers.set("Xero-Tenant-Id", xeroTenantId);
headers.setAccept("application/json");
headers.setUserAgent(this.getUserAgent());
// create a map of path variables
final Map uriVariables = new HashMap();
uriVariables.put("EmployeeID", employeeID);
UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Employees/{EmployeeID}");
String url = uriBuilder.buildFromMap(uriVariables).toString();
GenericUrl genericUrl = new GenericUrl(url);
if (logger.isDebugEnabled()) {
logger.debug("GET " + genericUrl.toString());
}
HttpContent content = null;
Credential credential =
new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken);
HttpTransport transport = apiClient.getHttpTransport();
HttpRequestFactory requestFactory = transport.createRequestFactory(credential);
return requestFactory
.buildRequest(HttpMethods.GET, genericUrl, content)
.setHeaders(headers)
.setConnectTimeout(apiClient.getConnectionTimeout())
.setReadTimeout(apiClient.getReadTimeout())
.execute();
}
/**
* Retrieves leave balances for a specific employee
*
* 200 - search results matching criteria
*
* @param xeroTenantId Xero identifier for Tenant
* @param employeeID Employee id for single object
* @param accessToken Authorization token for user set in header of each request
* @return EmployeeLeaveBalances
* @throws IOException if an error occurs while attempting to invoke the API *
*/
public EmployeeLeaveBalances getEmployeeLeaveBalances(
String accessToken, String xeroTenantId, UUID employeeID) throws IOException {
try {
TypeReference typeRef = new TypeReference() {};
HttpResponse response =
getEmployeeLeaveBalancesForHttpResponse(accessToken, xeroTenantId, employeeID);
return apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
} catch (HttpResponseException e) {
if (logger.isDebugEnabled()) {
logger.debug(
"------------------ HttpResponseException "
+ e.getStatusCode()
+ " : getEmployeeLeaveBalances -------------------");
logger.debug(e.toString());
}
XeroApiExceptionHandler handler = new XeroApiExceptionHandler();
if (e.getStatusCode() == 400 || e.getStatusCode() == 405) {
TypeReference errorTypeRef =
new TypeReference() {};
EmployeeLeaveBalances object =
apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef);
handler.validationError(e.getStatusCode(), "EmployeeLeaveBalances", object.getProblem(), e);
} else {
handler.execute(e);
}
} catch (IOException ioe) {
throw ioe;
}
return null;
}
/**
* Retrieves leave balances for a specific employee
*
* 200 - search results matching criteria
*
* @param xeroTenantId Xero identifier for Tenant
* @param employeeID Employee id for single object
* @param accessToken Authorization token for user set in header of each request
* @return HttpResponse
* @throws IOException if an error occurs while attempting to invoke the API
*/
public HttpResponse getEmployeeLeaveBalancesForHttpResponse(
String accessToken, String xeroTenantId, UUID employeeID) throws IOException {
// verify the required parameter 'xeroTenantId' is set
if (xeroTenantId == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'xeroTenantId' when calling getEmployeeLeaveBalances");
} // verify the required parameter 'employeeID' is set
if (employeeID == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'employeeID' when calling getEmployeeLeaveBalances");
}
if (accessToken == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'accessToken' when calling getEmployeeLeaveBalances");
}
HttpHeaders headers = new HttpHeaders();
headers.set("Xero-Tenant-Id", xeroTenantId);
headers.setAccept("application/json");
headers.setUserAgent(this.getUserAgent());
// create a map of path variables
final Map uriVariables = new HashMap();
uriVariables.put("EmployeeID", employeeID);
UriBuilder uriBuilder =
UriBuilder.fromUri(apiClient.getBasePath() + "/Employees/{EmployeeID}/LeaveBalances");
String url = uriBuilder.buildFromMap(uriVariables).toString();
GenericUrl genericUrl = new GenericUrl(url);
if (logger.isDebugEnabled()) {
logger.debug("GET " + genericUrl.toString());
}
HttpContent content = null;
Credential credential =
new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken);
HttpTransport transport = apiClient.getHttpTransport();
HttpRequestFactory requestFactory = transport.createRequestFactory(credential);
return requestFactory
.buildRequest(HttpMethods.GET, genericUrl, content)
.setHeaders(headers)
.setConnectTimeout(apiClient.getConnectionTimeout())
.setReadTimeout(apiClient.getReadTimeout())
.execute();
}
/**
* Retrieves leave periods for a specific employee
*
* 200 - search results matching criteria
*
*
400 - validation error for a bad request
*
* @param xeroTenantId Xero identifier for Tenant
* @param employeeID Employee id for single object
* @param startDate Filter by start date
* @param endDate Filter by end date
* @param accessToken Authorization token for user set in header of each request
* @return LeavePeriods
* @throws IOException if an error occurs while attempting to invoke the API *
*/
public LeavePeriods getEmployeeLeavePeriods(
String accessToken,
String xeroTenantId,
UUID employeeID,
LocalDate startDate,
LocalDate endDate)
throws IOException {
try {
TypeReference typeRef = new TypeReference() {};
HttpResponse response =
getEmployeeLeavePeriodsForHttpResponse(
accessToken, xeroTenantId, employeeID, startDate, endDate);
return apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
} catch (HttpResponseException e) {
if (logger.isDebugEnabled()) {
logger.debug(
"------------------ HttpResponseException "
+ e.getStatusCode()
+ " : getEmployeeLeavePeriods -------------------");
logger.debug(e.toString());
}
XeroApiExceptionHandler handler = new XeroApiExceptionHandler();
if (e.getStatusCode() == 400 || e.getStatusCode() == 405) {
TypeReference errorTypeRef = new TypeReference() {};
LeavePeriods object = apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef);
handler.validationError(e.getStatusCode(), "LeavePeriods", object.getProblem(), e);
} else {
handler.execute(e);
}
} catch (IOException ioe) {
throw ioe;
}
return null;
}
/**
* Retrieves leave periods for a specific employee
*
* 200 - search results matching criteria
*
*
400 - validation error for a bad request
*
* @param xeroTenantId Xero identifier for Tenant
* @param employeeID Employee id for single object
* @param startDate Filter by start date
* @param endDate Filter by end date
* @param accessToken Authorization token for user set in header of each request
* @return HttpResponse
* @throws IOException if an error occurs while attempting to invoke the API
*/
public HttpResponse getEmployeeLeavePeriodsForHttpResponse(
String accessToken,
String xeroTenantId,
UUID employeeID,
LocalDate startDate,
LocalDate endDate)
throws IOException {
// verify the required parameter 'xeroTenantId' is set
if (xeroTenantId == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'xeroTenantId' when calling getEmployeeLeavePeriods");
} // verify the required parameter 'employeeID' is set
if (employeeID == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'employeeID' when calling getEmployeeLeavePeriods");
}
if (accessToken == null) {
throw new IllegalArgumentException(
"Missing the required parameter 'accessToken' when calling getEmployeeLeavePeriods");
}
HttpHeaders headers = new HttpHeaders();
headers.set("Xero-Tenant-Id", xeroTenantId);
headers.setAccept("application/json");
headers.setUserAgent(this.getUserAgent());
// create a map of path variables
final Map uriVariables = new HashMap();
uriVariables.put("EmployeeID", employeeID);
UriBuilder uriBuilder =
UriBuilder.fromUri(apiClient.getBasePath() + "/Employees/{EmployeeID}/LeavePeriods");
if (startDate != null) {
String key = "startDate";
Object value = startDate;
if (value instanceof Collection) {
List valueList = new ArrayList<>((Collection) value);
if (!valueList.isEmpty() && valueList.get(0) instanceof UUID) {
List list = new ArrayList();
for (int i = 0; i < valueList.size(); i++) {
list.add(valueList.get(i).toString());
}
uriBuilder = uriBuilder.queryParam(key, String.join(",", list));
} else {
uriBuilder = uriBuilder.queryParam(key, String.join(",", valueList));
}
} else if (value instanceof Object[]) {
uriBuilder = uriBuilder.queryParam(key, (Object[]) value);
} else {
uriBuilder = uriBuilder.queryParam(key, value);
}
}
if (endDate != null) {
String key = "endDate";
Object value = endDate;
if (value instanceof Collection) {
List valueList = new ArrayList<>((Collection) value);
if (!valueList.isEmpty() && valueList.get(0) instanceof UUID) {
List list = new ArrayList();
for (int i = 0; i < valueList.size(); i++) {
list.add(valueList.get(i).toString());
}
uriBuilder = uriBuilder.queryParam(key, String.join(",", list));
} else {
uriBuilder = uriBuilder.queryParam(key, String.join(",", valueList));
}
} else if (value instanceof Object[]) {
uriBuilder = uriBuilder.queryParam(key, (Object[]) value);
} else {
uriBuilder = uriBuilder.queryParam(key, value);
}
}
String url = uriBuilder.buildFromMap(uriVariables).toString();
GenericUrl genericUrl = new GenericUrl(url);
if (logger.isDebugEnabled()) {
logger.debug("GET " + genericUrl.toString());
}
HttpContent content = null;
Credential credential =
new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken);
HttpTransport transport = apiClient.getHttpTransport();
HttpRequestFactory requestFactory = transport.createRequestFactory(credential);
return requestFactory
.buildRequest(HttpMethods.GET, genericUrl, content)
.setHeaders(headers)
.setConnectTimeout(apiClient.getConnectionTimeout())
.setReadTimeout(apiClient.getReadTimeout())
.execute();
}
/**
* Retrieves leave types for a specific employee
*
* 200 - search results matching criteria
*
*
400 - validation error for a bad request
*
* @param xeroTenantId Xero identifier for Tenant
* @param employeeID Employee id for single object
* @param accessToken Authorization token for user set in header of each request
* @return EmployeeLeaveTypes
* @throws IOException if an error occurs while attempting to invoke the API *
*/
public EmployeeLeaveTypes getEmployeeLeaveTypes(
String accessToken, String xeroTenantId, UUID employeeID) throws IOException {
try {
TypeReference typeRef = new TypeReference() {};
HttpResponse response =
getEmployeeLeaveTypesForHttpResponse(accessToken, xeroTenantId, employeeID);
return apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
} catch (HttpResponseException e) {
if (logger.isDebugEnabled()) {
logger.debug(
"------------------ HttpResponseException "
+ e.getStatusCode()
+ " : getEmployeeLeaveTypes -------------------");
logger.debug(e.toString());
}
XeroApiExceptionHandler handler = new XeroApiExceptionHandler();
if (e.getStatusCode() == 400 || e.getStatusCode() == 405) {
TypeReference errorTypeRef = new TypeReference() {};
EmployeeLeaveTypes object =
apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef);
handler.validationError(e.getStatusCode(), "EmployeeLeaveTypes", object.getProblem(), e);
} else {
handler.execute(e);
}
} catch (IOException ioe) {
throw ioe;
}
return null;
}
/**
* Retrieves leave types for a specific employee
*
*