All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.xero.api.client.PayrollUkApi Maven / Gradle / Ivy

/*
 * Xero Payroll UK
 * This is the Xero Payroll API for orgs in the UK 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.payrolluk.Benefit;
import com.xero.models.payrolluk.BenefitObject;
import com.xero.models.payrolluk.Benefits;
import com.xero.models.payrolluk.Deduction;
import com.xero.models.payrolluk.DeductionObject;
import com.xero.models.payrolluk.Deductions;
import com.xero.models.payrolluk.EarningsOrderObject;
import com.xero.models.payrolluk.EarningsOrders;
import com.xero.models.payrolluk.EarningsRate;
import com.xero.models.payrolluk.EarningsRateObject;
import com.xero.models.payrolluk.EarningsRates;
import com.xero.models.payrolluk.EarningsTemplate;
import com.xero.models.payrolluk.EarningsTemplateObject;
import com.xero.models.payrolluk.Employee;
import com.xero.models.payrolluk.EmployeeLeave;
import com.xero.models.payrolluk.EmployeeLeaveBalances;
import com.xero.models.payrolluk.EmployeeLeaveObject;
import com.xero.models.payrolluk.EmployeeLeaveType;
import com.xero.models.payrolluk.EmployeeLeaveTypeObject;
import com.xero.models.payrolluk.EmployeeLeaveTypes;
import com.xero.models.payrolluk.EmployeeLeaves;
import com.xero.models.payrolluk.EmployeeObject;
import com.xero.models.payrolluk.EmployeeOpeningBalances;
import com.xero.models.payrolluk.EmployeeOpeningBalancesObject;
import com.xero.models.payrolluk.EmployeePayTemplateObject;
import com.xero.models.payrolluk.EmployeePayTemplates;
import com.xero.models.payrolluk.EmployeeStatutoryLeaveBalanceObject;
import com.xero.models.payrolluk.EmployeeStatutoryLeavesSummaries;
import com.xero.models.payrolluk.EmployeeStatutorySickLeave;
import com.xero.models.payrolluk.EmployeeStatutorySickLeaveObject;
import com.xero.models.payrolluk.EmployeeTaxObject;
import com.xero.models.payrolluk.Employees;
import com.xero.models.payrolluk.Employment;
import com.xero.models.payrolluk.EmploymentObject;
import com.xero.models.payrolluk.LeavePeriods;
import com.xero.models.payrolluk.LeaveType;
import com.xero.models.payrolluk.LeaveTypeObject;
import com.xero.models.payrolluk.LeaveTypes;
import com.xero.models.payrolluk.PayRun;
import com.xero.models.payrolluk.PayRunCalendar;
import com.xero.models.payrolluk.PayRunCalendarObject;
import com.xero.models.payrolluk.PayRunCalendars;
import com.xero.models.payrolluk.PayRunObject;
import com.xero.models.payrolluk.PayRuns;
import com.xero.models.payrolluk.PaymentMethod;
import com.xero.models.payrolluk.PaymentMethodObject;
import com.xero.models.payrolluk.PayslipObject;
import com.xero.models.payrolluk.Payslips;
import com.xero.models.payrolluk.Reimbursement;
import com.xero.models.payrolluk.ReimbursementObject;
import com.xero.models.payrolluk.Reimbursements;
import com.xero.models.payrolluk.SalaryAndWage;
import com.xero.models.payrolluk.SalaryAndWageObject;
import com.xero.models.payrolluk.SalaryAndWages;
import com.xero.models.payrolluk.Settings;
import com.xero.models.payrolluk.Timesheet;
import com.xero.models.payrolluk.TimesheetLine;
import com.xero.models.payrolluk.TimesheetLineObject;
import com.xero.models.payrolluk.TimesheetObject;
import com.xero.models.payrolluk.Timesheets;
import com.xero.models.payrolluk.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;

/** PayrollUkApi has methods for interacting with all endpoints in the API set */
public class PayrollUkApi {
  private ApiClient apiClient;
  private static PayrollUkApi instance = null;
  private String userAgent = "Default";
  private String version = "8.3.0";
  static final Logger logger = LoggerFactory.getLogger(PayrollUkApi.class);

  /** PayrollUkApi */
  public PayrollUkApi() {
    this(new ApiClient());
  }

  /**
   * PayrollUkApi getInstance
   *
   * @param apiClient ApiClient pass into the new instance of this class
   * @return instance of this class
   */
  public static PayrollUkApi getInstance(ApiClient apiClient) {
    if (instance == null) {
      instance = new PayrollUkApi(apiClient);
    }
    return instance;
  }

  /**
   * PayrollUkApi
   *
   * @param apiClient ApiClient pass into the new instance of this class
   */
  public PayrollUkApi(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 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 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 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 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 employee benefit * *

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 BenefitObject * @throws IOException if an error occurs while attempting to invoke the API * */ public BenefitObject createBenefit( String accessToken, String xeroTenantId, Benefit benefit, String idempotencyKey) throws IOException { try { TypeReference typeRef = new TypeReference() {}; HttpResponse response = createBenefitForHttpResponse(accessToken, xeroTenantId, benefit, idempotencyKey); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { if (logger.isDebugEnabled()) { logger.debug( "------------------ HttpResponseException " + e.getStatusCode() + " : createBenefit -------------------"); logger.debug(e.toString()); } XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); if (e.getStatusCode() == 400 || e.getStatusCode() == 405) { TypeReference errorTypeRef = new TypeReference() {}; BenefitObject object = apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef); handler.validationError(e.getStatusCode(), "BenefitObject", object.getProblem(), e); } else { handler.execute(e); } } catch (IOException ioe) { throw ioe; } return null; } /** * Creates a new employee benefit * *

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 createBenefitForHttpResponse( 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 createBenefit"); } // verify the required parameter 'benefit' is set if (benefit == null) { throw new IllegalArgumentException( "Missing the required parameter 'benefit' when calling createBenefit"); } if (accessToken == null) { throw new IllegalArgumentException( "Missing the required parameter 'accessToken' when calling createBenefit"); } 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() + "/Benefits"); 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 deduction * *

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 * *

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 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 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 an 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 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 an 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 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 employee leave type records * *

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 employee leave type records * *

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 an opening balance 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 employeeOpeningBalances The employeeOpeningBalances 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, EmployeeOpeningBalances employeeOpeningBalances, String idempotencyKey) throws IOException { try { TypeReference typeRef = new TypeReference() {}; HttpResponse response = createEmployeeOpeningBalancesForHttpResponse( accessToken, xeroTenantId, employeeID, employeeOpeningBalances, 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 an opening balance 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 employeeOpeningBalances The employeeOpeningBalances 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, EmployeeOpeningBalances employeeOpeningBalances, 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 'employeeOpeningBalances' is set if (employeeOpeningBalances == null) { throw new IllegalArgumentException( "Missing the required parameter 'employeeOpeningBalances' 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}/ukopeningbalances"); 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(employeeOpeningBalances); 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 payment method * *

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 an employee payment method * *

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 a salary and wage record 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 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 a salary and wage record 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 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 statutory sick leave records * *

200 - search results matching criteria * *

400 - validation error for a bad request * * @param xeroTenantId Xero identifier for Tenant * @param employeeStatutorySickLeave The employeeStatutorySickLeave 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 EmployeeStatutorySickLeaveObject * @throws IOException if an error occurs while attempting to invoke the API * */ public EmployeeStatutorySickLeaveObject createEmployeeStatutorySickLeave( String accessToken, String xeroTenantId, EmployeeStatutorySickLeave employeeStatutorySickLeave, String idempotencyKey) throws IOException { try { TypeReference typeRef = new TypeReference() {}; HttpResponse response = createEmployeeStatutorySickLeaveForHttpResponse( accessToken, xeroTenantId, employeeStatutorySickLeave, idempotencyKey); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { if (logger.isDebugEnabled()) { logger.debug( "------------------ HttpResponseException " + e.getStatusCode() + " : createEmployeeStatutorySickLeave -------------------"); logger.debug(e.toString()); } XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); if (e.getStatusCode() == 400 || e.getStatusCode() == 405) { TypeReference errorTypeRef = new TypeReference() {}; EmployeeStatutorySickLeaveObject object = apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef); handler.validationError( e.getStatusCode(), "EmployeeStatutorySickLeaveObject", object.getProblem(), e); } else { handler.execute(e); } } catch (IOException ioe) { throw ioe; } return null; } /** * Creates statutory sick leave records * *

200 - search results matching criteria * *

400 - validation error for a bad request * * @param xeroTenantId Xero identifier for Tenant * @param employeeStatutorySickLeave The employeeStatutorySickLeave 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 createEmployeeStatutorySickLeaveForHttpResponse( String accessToken, String xeroTenantId, EmployeeStatutorySickLeave employeeStatutorySickLeave, String idempotencyKey) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException( "Missing the required parameter 'xeroTenantId' when calling" + " createEmployeeStatutorySickLeave"); } // verify the required parameter 'employeeStatutorySickLeave' is set if (employeeStatutorySickLeave == null) { throw new IllegalArgumentException( "Missing the required parameter 'employeeStatutorySickLeave' when calling" + " createEmployeeStatutorySickLeave"); } if (accessToken == null) { throw new IllegalArgumentException( "Missing the required parameter 'accessToken' when calling" + " createEmployeeStatutorySickLeave"); } 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() + "/StatutoryLeaves/Sick"); 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(employeeStatutorySickLeave); 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 employment detail for a specific employee using a unique employee ID * *

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 employment detail for a specific employee using a unique employee ID * *

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 earnings template records for a specific employee using a unique employee ID * *

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 EmployeePayTemplates * @throws IOException if an error occurs while attempting to invoke the API * */ public EmployeePayTemplates 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() {}; EmployeePayTemplates object = apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef); handler.validationError(e.getStatusCode(), "EmployeePayTemplates", object.getProblem(), e); } else { handler.execute(e); } } catch (IOException ioe) { throw ioe; } return null; } /** * Creates multiple earnings template records for a specific employee using a unique employee ID * *

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 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 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(); } /** * Creates a new timesheet line for a specific timesheet using a unique timesheet ID * *

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; } /** * Creates a new timesheet line for a specific timesheet using a unique timesheet ID * *

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 a specific 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 * @throws IOException if an error occurs while attempting to invoke the API * */ public void deleteEmployeeEarningsTemplate( String accessToken, String xeroTenantId, UUID employeeID, UUID payTemplateEarningID) throws IOException { try { deleteEmployeeEarningsTemplateForHttpResponse( accessToken, xeroTenantId, employeeID, payTemplateEarningID); } 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; } } /** * Deletes a specific 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(""); 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 specific employee's leave record * *

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 specific employee's leave record * *

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 a salary and wages record for a specific employee * *

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 * @throws IOException if an error occurs while attempting to invoke the API * */ public void deleteEmployeeSalaryAndWage( String accessToken, String xeroTenantId, UUID employeeID, UUID salaryAndWagesID) throws IOException { try { deleteEmployeeSalaryAndWageForHttpResponse( accessToken, xeroTenantId, employeeID, salaryAndWagesID); } 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; } } /** * Deletes a salary and wages record for a specific employee * *

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(""); 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 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 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 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 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 specific timesheet line * *

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 specific timesheet line * *

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 specific benefit by using a unique benefit ID * *

200 - search results matching criteria * * @param xeroTenantId Xero identifier for Tenant * @param id Identifier for the benefit * @param accessToken Authorization token for user set in header of each request * @return BenefitObject * @throws IOException if an error occurs while attempting to invoke the API * */ public BenefitObject getBenefit(String accessToken, String xeroTenantId, UUID id) throws IOException { try { TypeReference typeRef = new TypeReference() {}; HttpResponse response = getBenefitForHttpResponse(accessToken, xeroTenantId, id); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { if (logger.isDebugEnabled()) { logger.debug( "------------------ HttpResponseException " + e.getStatusCode() + " : getBenefit -------------------"); logger.debug(e.toString()); } XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); if (e.getStatusCode() == 400 || e.getStatusCode() == 405) { TypeReference errorTypeRef = new TypeReference() {}; BenefitObject object = apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef); handler.validationError(e.getStatusCode(), "BenefitObject", object.getProblem(), e); } else { handler.execute(e); } } catch (IOException ioe) { throw ioe; } return null; } /** * Retrieves a specific benefit by using a unique benefit ID * *

200 - search results matching criteria * * @param xeroTenantId Xero identifier for Tenant * @param id Identifier for the benefit * @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 getBenefitForHttpResponse(String accessToken, String xeroTenantId, UUID id) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException( "Missing the required parameter 'xeroTenantId' when calling getBenefit"); } // verify the required parameter 'id' is set if (id == null) { throw new IllegalArgumentException( "Missing the required parameter 'id' when calling getBenefit"); } if (accessToken == null) { throw new IllegalArgumentException( "Missing the required parameter 'accessToken' when calling getBenefit"); } 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("id", id); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Benefits/{id}"); 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 employee benefits * *

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 Benefits * @throws IOException if an error occurs while attempting to invoke the API * */ public Benefits getBenefits(String accessToken, String xeroTenantId, Integer page) throws IOException { try { TypeReference typeRef = new TypeReference() {}; HttpResponse response = getBenefitsForHttpResponse(accessToken, xeroTenantId, page); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { if (logger.isDebugEnabled()) { logger.debug( "------------------ HttpResponseException " + e.getStatusCode() + " : getBenefits -------------------"); logger.debug(e.toString()); } XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); if (e.getStatusCode() == 400 || e.getStatusCode() == 405) { TypeReference errorTypeRef = new TypeReference() {}; Benefits object = apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef); handler.validationError(e.getStatusCode(), "Benefits", object.getProblem(), e); } else { handler.execute(e); } } catch (IOException ioe) { throw ioe; } return null; } /** * Retrieves employee benefits * *

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 getBenefitsForHttpResponse( 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 getBenefits"); } if (accessToken == null) { throw new IllegalArgumentException( "Missing the required parameter 'accessToken' when calling getBenefits"); } HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Benefits"); 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 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 specific 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 * *

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 * *

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 orders by using a unique earnings orders id * *

200 - search results matching criteria * * @param xeroTenantId Xero identifier for Tenant * @param id Identifier for the deduction * @param accessToken Authorization token for user set in header of each request * @return EarningsOrderObject * @throws IOException if an error occurs while attempting to invoke the API * */ public EarningsOrderObject getEarningsOrder(String accessToken, String xeroTenantId, UUID id) throws IOException { try { TypeReference typeRef = new TypeReference() {}; HttpResponse response = getEarningsOrderForHttpResponse(accessToken, xeroTenantId, id); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { if (logger.isDebugEnabled()) { logger.debug( "------------------ HttpResponseException " + e.getStatusCode() + " : getEarningsOrder -------------------"); logger.debug(e.toString()); } XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); if (e.getStatusCode() == 400 || e.getStatusCode() == 405) { TypeReference errorTypeRef = new TypeReference() {}; EarningsOrderObject object = apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef); handler.validationError(e.getStatusCode(), "EarningsOrderObject", object.getProblem(), e); } else { handler.execute(e); } } catch (IOException ioe) { throw ioe; } return null; } /** * Retrieves a specific earnings orders by using a unique earnings orders id * *

200 - search results matching criteria * * @param xeroTenantId Xero identifier for Tenant * @param id 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 getEarningsOrderForHttpResponse( String accessToken, String xeroTenantId, UUID id) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException( "Missing the required parameter 'xeroTenantId' when calling getEarningsOrder"); } // verify the required parameter 'id' is set if (id == null) { throw new IllegalArgumentException( "Missing the required parameter 'id' when calling getEarningsOrder"); } if (accessToken == null) { throw new IllegalArgumentException( "Missing the required parameter 'accessToken' when calling getEarningsOrder"); } 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("id", id); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/EarningsOrders/{id}"); 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 orders * *

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 EarningsOrders * @throws IOException if an error occurs while attempting to invoke the API * */ public EarningsOrders getEarningsOrders(String accessToken, String xeroTenantId, Integer page) throws IOException { try { TypeReference typeRef = new TypeReference() {}; HttpResponse response = getEarningsOrdersForHttpResponse(accessToken, xeroTenantId, page); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { if (logger.isDebugEnabled()) { logger.debug( "------------------ HttpResponseException " + e.getStatusCode() + " : getEarningsOrders -------------------"); logger.debug(e.toString()); } XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); if (e.getStatusCode() == 400 || e.getStatusCode() == 405) { TypeReference errorTypeRef = new TypeReference() {}; EarningsOrders object = apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef); handler.validationError(e.getStatusCode(), "EarningsOrders", object.getProblem(), e); } else { handler.execute(e); } } catch (IOException ioe) { throw ioe; } return null; } /** * Retrieves earnings orders * *

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 getEarningsOrdersForHttpResponse( 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 getEarningsOrders"); } if (accessToken == null) { throw new IllegalArgumentException( "Missing the required parameter 'accessToken' when calling getEarningsOrders"); } HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/EarningsOrders"); 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 specific employees by 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 specific employees by 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 a specific employee's leave record using a unique employee ID * *

200 - search results matching criteria * * @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 getEmployeeLeave( String accessToken, String xeroTenantId, UUID employeeID, UUID leaveID) throws IOException { try { TypeReference typeRef = new TypeReference() {}; HttpResponse response = getEmployeeLeaveForHttpResponse(accessToken, xeroTenantId, employeeID, leaveID); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { if (logger.isDebugEnabled()) { logger.debug( "------------------ HttpResponseException " + e.getStatusCode() + " : getEmployeeLeave -------------------"); 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; } /** * Retrieves a specific employee's leave record using a unique employee ID * *

200 - search results matching criteria * * @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 getEmployeeLeaveForHttpResponse( 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 getEmployeeLeave"); } // verify the required parameter 'employeeID' is set if (employeeID == null) { throw new IllegalArgumentException( "Missing the required parameter 'employeeID' when calling getEmployeeLeave"); } // verify the required parameter 'leaveID' is set if (leaveID == null) { throw new IllegalArgumentException( "Missing the required parameter 'leaveID' when calling getEmployeeLeave"); } if (accessToken == null) { throw new IllegalArgumentException( "Missing the required parameter 'accessToken' when calling getEmployeeLeave"); } 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("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 employee's leave balances 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 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 a specific employee's leave balances 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 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 a specific employee's leave periods using a unique employee ID * *

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 a specific employee's leave periods using a unique employee ID * *

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 a specific employee's leave types using a unique employee ID * *

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 a specific employee's leave types using a unique employee ID * *

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 HttpResponse * @throws IOException if an error occurs while attempting to invoke the API */ public HttpResponse getEmployeeLeaveTypesForHttpResponse( 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 getEmployeeLeaveTypes"); } // verify the required parameter 'employeeID' is set if (employeeID == null) { throw new IllegalArgumentException( "Missing the required parameter 'employeeID' when calling getEmployeeLeaveTypes"); } if (accessToken == null) { throw new IllegalArgumentException( "Missing the required parameter 'accessToken' when calling getEmployeeLeaveTypes"); } 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}/LeaveTypes"); 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 a specific employee's leave records 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 EmployeeLeaves * @throws IOException if an error occurs while attempting to invoke the API * */ public EmployeeLeaves getEmployeeLeaves(String accessToken, String xeroTenantId, UUID employeeID) throws IOException { try { TypeReference typeRef = new TypeReference() {}; HttpResponse response = getEmployeeLeavesForHttpResponse(accessToken, xeroTenantId, employeeID); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { if (logger.isDebugEnabled()) { logger.debug( "------------------ HttpResponseException " + e.getStatusCode() + " : getEmployeeLeaves -------------------"); logger.debug(e.toString()); } XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); if (e.getStatusCode() == 400 || e.getStatusCode() == 405) { TypeReference errorTypeRef = new TypeReference() {}; EmployeeLeaves object = apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef); handler.validationError(e.getStatusCode(), "EmployeeLeaves", object.getProblem(), e); } else { handler.execute(e); } } catch (IOException ioe) { throw ioe; } return null; } /** * Retrieves a specific employee's leave records 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 getEmployeeLeavesForHttpResponse( 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 getEmployeeLeaves"); } // verify the required parameter 'employeeID' is set if (employeeID == null) { throw new IllegalArgumentException( "Missing the required parameter 'employeeID' when calling getEmployeeLeaves"); } if (accessToken == null) { throw new IllegalArgumentException( "Missing the required parameter 'accessToken' when calling getEmployeeLeaves"); } 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}/Leave"); 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 a specific employee's openingbalances 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 EmployeeOpeningBalancesObject * @throws IOException if an error occurs while attempting to invoke the API * */ public EmployeeOpeningBalancesObject getEmployeeOpeningBalances( String accessToken, String xeroTenantId, UUID employeeID) throws IOException { try { TypeReference typeRef = new TypeReference() {}; HttpResponse response = getEmployeeOpeningBalancesForHttpResponse(accessToken, xeroTenantId, employeeID); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { if (logger.isDebugEnabled()) { logger.debug( "------------------ HttpResponseException " + e.getStatusCode() + " : getEmployeeOpeningBalances -------------------"); 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; } /** * Retrieves a specific employee's openingbalances 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 getEmployeeOpeningBalancesForHttpResponse( 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 getEmployeeOpeningBalances"); } // verify the required parameter 'employeeID' is set if (employeeID == null) { throw new IllegalArgumentException( "Missing the required parameter 'employeeID' when calling getEmployeeOpeningBalances"); } if (accessToken == null) { throw new IllegalArgumentException( "Missing the required parameter 'accessToken' when calling getEmployeeOpeningBalances"); } 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}/ukopeningbalances"); 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 a specific employee pay templates using a unique employee ID * *

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 EmployeePayTemplateObject * @throws IOException if an error occurs while attempting to invoke the API * */ public EmployeePayTemplateObject getEmployeePayTemplate( String accessToken, String xeroTenantId, UUID employeeID) throws IOException { try { TypeReference typeRef = new TypeReference() {}; HttpResponse response = getEmployeePayTemplateForHttpResponse(accessToken, xeroTenantId, employeeID); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { if (logger.isDebugEnabled()) { logger.debug( "------------------ HttpResponseException " + e.getStatusCode() + " : getEmployeePayTemplate -------------------"); logger.debug(e.toString()); } XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); if (e.getStatusCode() == 400 || e.getStatusCode() == 405) { TypeReference errorTypeRef = new TypeReference() {}; EmployeePayTemplateObject object = apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef); handler.validationError( e.getStatusCode(), "EmployeePayTemplateObject", object.getProblem(), e); } else { handler.execute(e); } } catch (IOException ioe) { throw ioe; } return null; } /** * Retrieves a specific employee pay templates using a unique employee ID * *

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 HttpResponse * @throws IOException if an error occurs while attempting to invoke the API */ public HttpResponse getEmployeePayTemplateForHttpResponse( 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 getEmployeePayTemplate"); } // verify the required parameter 'employeeID' is set if (employeeID == null) { throw new IllegalArgumentException( "Missing the required parameter 'employeeID' when calling getEmployeePayTemplate"); } if (accessToken == null) { throw new IllegalArgumentException( "Missing the required parameter 'accessToken' when calling getEmployeePayTemplate"); } 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}/PayTemplates"); 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 a specific employee's payment method using a unique employee ID * *

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 PaymentMethodObject * @throws IOException if an error occurs while attempting to invoke the API * */ public PaymentMethodObject getEmployeePaymentMethod( String accessToken, String xeroTenantId, UUID employeeID) throws IOException { try { TypeReference typeRef = new TypeReference() {}; HttpResponse response = getEmployeePaymentMethodForHttpResponse(accessToken, xeroTenantId, employeeID); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { if (logger.isDebugEnabled()) { logger.debug( "------------------ HttpResponseException " + e.getStatusCode() + " : getEmployeePaymentMethod -------------------"); 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; } /** * Retrieves a specific employee's payment method using a unique employee ID * *

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 HttpResponse * @throws IOException if an error occurs while attempting to invoke the API */ public HttpResponse getEmployeePaymentMethodForHttpResponse( 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 getEmployeePaymentMethod"); } // verify the required parameter 'employeeID' is set if (employeeID == null) { throw new IllegalArgumentException( "Missing the required parameter 'employeeID' when calling getEmployeePaymentMethod"); } if (accessToken == null) { throw new IllegalArgumentException( "Missing the required parameter 'accessToken' when calling getEmployeePaymentMethod"); } 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}/PaymentMethods"); 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 a specific salary and wages record for a specific employee using a unique salary and * wage id * *

200 - search results matching criteria * * @param xeroTenantId Xero identifier for Tenant * @param employeeID Employee id for single object * @param salaryAndWagesID Id for single pay template earnings object * @param accessToken Authorization token for user set in header of each request * @return SalaryAndWages * @throws IOException if an error occurs while attempting to invoke the API * */ public SalaryAndWages getEmployeeSalaryAndWage( String accessToken, String xeroTenantId, UUID employeeID, UUID salaryAndWagesID) throws IOException { try { TypeReference typeRef = new TypeReference() {}; HttpResponse response = getEmployeeSalaryAndWageForHttpResponse( accessToken, xeroTenantId, employeeID, salaryAndWagesID); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { if (logger.isDebugEnabled()) { logger.debug( "------------------ HttpResponseException " + e.getStatusCode() + " : getEmployeeSalaryAndWage -------------------"); logger.debug(e.toString()); } XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); if (e.getStatusCode() == 400 || e.getStatusCode() == 405) { TypeReference errorTypeRef = new TypeReference() {}; SalaryAndWages object = apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef); handler.validationError(e.getStatusCode(), "SalaryAndWages", object.getProblem(), e); } else { handler.execute(e); } } catch (IOException ioe) { throw ioe; } return null; } /** * Retrieves a specific salary and wages record for a specific employee using a unique salary and * wage id * *

200 - search results matching criteria * * @param xeroTenantId Xero identifier for Tenant * @param employeeID Employee id for single object * @param salaryAndWagesID 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 getEmployeeSalaryAndWageForHttpResponse( 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 getEmployeeSalaryAndWage"); } // verify the required parameter 'employeeID' is set if (employeeID == null) { throw new IllegalArgumentException( "Missing the required parameter 'employeeID' when calling getEmployeeSalaryAndWage"); } // verify the required parameter 'salaryAndWagesID' is set if (salaryAndWagesID == null) { throw new IllegalArgumentException( "Missing the required parameter 'salaryAndWagesID' when calling" + " getEmployeeSalaryAndWage"); } if (accessToken == null) { throw new IllegalArgumentException( "Missing the required parameter 'accessToken' when calling getEmployeeSalaryAndWage"); } 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("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 employee's salary and wages by using a unique employee ID * *

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 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 SalaryAndWages * @throws IOException if an error occurs while attempting to invoke the API * */ public SalaryAndWages getEmployeeSalaryAndWages( String accessToken, String xeroTenantId, UUID employeeID, Integer page) throws IOException { try { TypeReference typeRef = new TypeReference() {}; HttpResponse response = getEmployeeSalaryAndWagesForHttpResponse(accessToken, xeroTenantId, employeeID, page); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { if (logger.isDebugEnabled()) { logger.debug( "------------------ HttpResponseException " + e.getStatusCode() + " : getEmployeeSalaryAndWages -------------------"); logger.debug(e.toString()); } XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); if (e.getStatusCode() == 400 || e.getStatusCode() == 405) { TypeReference errorTypeRef = new TypeReference() {}; SalaryAndWages object = apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef); handler.validationError(e.getStatusCode(), "SalaryAndWages", object.getProblem(), e); } else { handler.execute(e); } } catch (IOException ioe) { throw ioe; } return null; } /** * Retrieves a specific employee's salary and wages by using a unique employee ID * *

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 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 getEmployeeSalaryAndWagesForHttpResponse( String accessToken, String xeroTenantId, UUID employeeID, Integer page) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException( "Missing the required parameter 'xeroTenantId' when calling getEmployeeSalaryAndWages"); } // verify the required parameter 'employeeID' is set if (employeeID == null) { throw new IllegalArgumentException( "Missing the required parameter 'employeeID' when calling getEmployeeSalaryAndWages"); } if (accessToken == null) { throw new IllegalArgumentException( "Missing the required parameter 'accessToken' when calling getEmployeeSalaryAndWages"); } 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}/SalaryAndWages"); 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.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 a specific employee's leave balances using a unique employee ID * *

200 - search results matching criteria * * @param xeroTenantId Xero identifier for Tenant * @param employeeID Employee id for single object * @param leaveType Filter by the type of statutory leave * @param asOfDate The date from which to calculate balance remaining. If not specified, current * date UTC is used. * @param accessToken Authorization token for user set in header of each request * @return EmployeeStatutoryLeaveBalanceObject * @throws IOException if an error occurs while attempting to invoke the API * */ public EmployeeStatutoryLeaveBalanceObject getEmployeeStatutoryLeaveBalances( String accessToken, String xeroTenantId, UUID employeeID, String leaveType, LocalDate asOfDate) throws IOException { try { TypeReference typeRef = new TypeReference() {}; HttpResponse response = getEmployeeStatutoryLeaveBalancesForHttpResponse( accessToken, xeroTenantId, employeeID, leaveType, asOfDate); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { if (logger.isDebugEnabled()) { logger.debug( "------------------ HttpResponseException " + e.getStatusCode() + " : getEmployeeStatutoryLeaveBalances -------------------"); logger.debug(e.toString()); } XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); if (e.getStatusCode() == 400 || e.getStatusCode() == 405) { TypeReference errorTypeRef = new TypeReference() {}; EmployeeStatutoryLeaveBalanceObject object = apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef); handler.validationError( e.getStatusCode(), "EmployeeStatutoryLeaveBalanceObject", object.getProblem(), e); } else { handler.execute(e); } } catch (IOException ioe) { throw ioe; } return null; } /** * Retrieves a specific employee's leave balances using a unique employee ID * *

200 - search results matching criteria * * @param xeroTenantId Xero identifier for Tenant * @param employeeID Employee id for single object * @param leaveType Filter by the type of statutory leave * @param asOfDate The date from which to calculate balance remaining. If not specified, current * date UTC is used. * @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 getEmployeeStatutoryLeaveBalancesForHttpResponse( String accessToken, String xeroTenantId, UUID employeeID, String leaveType, LocalDate asOfDate) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException( "Missing the required parameter 'xeroTenantId' when calling" + " getEmployeeStatutoryLeaveBalances"); } // verify the required parameter 'employeeID' is set if (employeeID == null) { throw new IllegalArgumentException( "Missing the required parameter 'employeeID' when calling" + " getEmployeeStatutoryLeaveBalances"); } if (accessToken == null) { throw new IllegalArgumentException( "Missing the required parameter 'accessToken' when calling" + " getEmployeeStatutoryLeaveBalances"); } 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}/StatutoryLeaveBalance"); if (leaveType != null) { String key = "LeaveType"; Object value = leaveType; 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 (asOfDate != null) { String key = "AsOfDate"; Object value = asOfDate; 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 a statutory sick leave for an employee * *

200 - search results matching criteria * * @param xeroTenantId Xero identifier for Tenant * @param statutorySickLeaveID Statutory sick leave id for single object * @param accessToken Authorization token for user set in header of each request * @return EmployeeStatutorySickLeaveObject * @throws IOException if an error occurs while attempting to invoke the API * */ public EmployeeStatutorySickLeaveObject getEmployeeStatutorySickLeave( String accessToken, String xeroTenantId, UUID statutorySickLeaveID) throws IOException { try { TypeReference typeRef = new TypeReference() {}; HttpResponse response = getEmployeeStatutorySickLeaveForHttpResponse( accessToken, xeroTenantId, statutorySickLeaveID); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { if (logger.isDebugEnabled()) { logger.debug( "------------------ HttpResponseException " + e.getStatusCode() + " : getEmployeeStatutorySickLeave -------------------"); logger.debug(e.toString()); } XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); if (e.getStatusCode() == 400 || e.getStatusCode() == 405) { TypeReference errorTypeRef = new TypeReference() {}; EmployeeStatutorySickLeaveObject object = apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef); handler.validationError( e.getStatusCode(), "EmployeeStatutorySickLeaveObject", object.getProblem(), e); } else { handler.execute(e); } } catch (IOException ioe) { throw ioe; } return null; } /** * Retrieves a statutory sick leave for an employee * *

200 - search results matching criteria * * @param xeroTenantId Xero identifier for Tenant * @param statutorySickLeaveID Statutory sick 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 getEmployeeStatutorySickLeaveForHttpResponse( String accessToken, String xeroTenantId, UUID statutorySickLeaveID) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException( "Missing the required parameter 'xeroTenantId' when calling" + " getEmployeeStatutorySickLeave"); } // verify the required parameter 'statutorySickLeaveID' is set if (statutorySickLeaveID == null) { throw new IllegalArgumentException( "Missing the required parameter 'statutorySickLeaveID' when calling" + " getEmployeeStatutorySickLeave"); } if (accessToken == null) { throw new IllegalArgumentException( "Missing the required parameter 'accessToken' when calling" + " getEmployeeStatutorySickLeave"); } 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("StatutorySickLeaveID", statutorySickLeaveID); UriBuilder uriBuilder = UriBuilder.fromUri( apiClient.getBasePath() + "/StatutoryLeaves/Sick/{StatutorySickLeaveID}"); 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 tax records for a specific employee 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 EmployeeTaxObject * @throws IOException if an error occurs while attempting to invoke the API * */ public EmployeeTaxObject getEmployeeTax(String accessToken, String xeroTenantId, UUID employeeID) throws IOException { try { TypeReference typeRef = new TypeReference() {}; HttpResponse response = getEmployeeTaxForHttpResponse(accessToken, xeroTenantId, employeeID); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { if (logger.isDebugEnabled()) { logger.debug( "------------------ HttpResponseException " + e.getStatusCode() + " : getEmployeeTax -------------------"); logger.debug(e.toString()); } XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); if (e.getStatusCode() == 400 || e.getStatusCode() == 405) { TypeReference errorTypeRef = new TypeReference() {}; EmployeeTaxObject object = apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef); handler.validationError(e.getStatusCode(), "EmployeeTaxObject", object.getProblem(), e); } else { handler.execute(e); } } catch (IOException ioe) { throw ioe; } return null; } /** * Retrieves tax records for a specific employee 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 getEmployeeTaxForHttpResponse( 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 getEmployeeTax"); } // verify the required parameter 'employeeID' is set if (employeeID == null) { throw new IllegalArgumentException( "Missing the required parameter 'employeeID' when calling getEmployeeTax"); } if (accessToken == null) { throw new IllegalArgumentException( "Missing the required parameter 'accessToken' when calling getEmployeeTax"); } 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}/Tax"); 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 employees * *

200 - search results matching criteria * *

400 - validation error for a bad request * * @param xeroTenantId Xero identifier for Tenant * @param filter Filter by first name, lastname, and/or whether they are an off-payroll worker * @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 Employees * @throws IOException if an error occurs while attempting to invoke the API * */ public Employees getEmployees( String accessToken, String xeroTenantId, String filter, Integer page) throws IOException { try { TypeReference typeRef = new TypeReference() {}; HttpResponse response = getEmployeesForHttpResponse(accessToken, xeroTenantId, filter, page); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { if (logger.isDebugEnabled()) { logger.debug( "------------------ HttpResponseException " + e.getStatusCode() + " : getEmployees -------------------"); logger.debug(e.toString()); } XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); if (e.getStatusCode() == 400 || e.getStatusCode() == 405) { TypeReference errorTypeRef = new TypeReference() {}; Employees object = apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef); handler.validationError(e.getStatusCode(), "Employees", object.getProblem(), e); } else { handler.execute(e); } } catch (IOException ioe) { throw ioe; } return null; } /** * Retrieves employees * *

200 - search results matching criteria * *

400 - validation error for a bad request * * @param xeroTenantId Xero identifier for Tenant * @param filter Filter by first name, lastname, and/or whether they are an off-payroll worker * @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 getEmployeesForHttpResponse( String accessToken, String xeroTenantId, String filter, Integer page) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException( "Missing the required parameter 'xeroTenantId' when calling getEmployees"); } if (accessToken == null) { throw new IllegalArgumentException( "Missing the required parameter 'accessToken' when calling getEmployees"); } HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Employees"); if (filter != null) { String key = "filter"; Object value = filter; 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 (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 leave type by using a unique leave type ID * *

200 - search results matching criteria * * @param xeroTenantId Xero identifier for Tenant * @param leaveTypeID Identifier for the leave type * @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 getLeaveType(String accessToken, String xeroTenantId, UUID leaveTypeID) throws IOException { try { TypeReference typeRef = new TypeReference() {}; HttpResponse response = getLeaveTypeForHttpResponse(accessToken, xeroTenantId, leaveTypeID); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { if (logger.isDebugEnabled()) { logger.debug( "------------------ HttpResponseException " + e.getStatusCode() + " : getLeaveType -------------------"); 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; } /** * Retrieves a specific leave type by using a unique leave type ID * *

200 - search results matching criteria * * @param xeroTenantId Xero identifier for Tenant * @param leaveTypeID Identifier for the leave type * @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 getLeaveTypeForHttpResponse( String accessToken, String xeroTenantId, UUID leaveTypeID) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException( "Missing the required parameter 'xeroTenantId' when calling getLeaveType"); } // verify the required parameter 'leaveTypeID' is set if (leaveTypeID == null) { throw new IllegalArgumentException( "Missing the required parameter 'leaveTypeID' when calling getLeaveType"); } if (accessToken == null) { throw new IllegalArgumentException( "Missing the required parameter 'accessToken' when calling getLeaveType"); } 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("LeaveTypeID", leaveTypeID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/LeaveTypes/{LeaveTypeID}"); 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 * *

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 activeOnly Filters leave types by active status. By default the API returns all leave * types. * @param accessToken Authorization token for user set in header of each request * @return LeaveTypes * @throws IOException if an error occurs while attempting to invoke the API * */ public LeaveTypes getLeaveTypes( String accessToken, String xeroTenantId, Integer page, Boolean activeOnly) throws IOException { try { TypeReference typeRef = new TypeReference() {}; HttpResponse response = getLeaveTypesForHttpResponse(accessToken, xeroTenantId, page, activeOnly); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { if (logger.isDebugEnabled()) { logger.debug( "------------------ HttpResponseException " + e.getStatusCode() + " : getLeaveTypes -------------------"); logger.debug(e.toString()); } XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); if (e.getStatusCode() == 400 || e.getStatusCode() == 405) { TypeReference errorTypeRef = new TypeReference() {}; LeaveTypes object = apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef); handler.validationError(e.getStatusCode(), "LeaveTypes", object.getProblem(), e); } else { handler.execute(e); } } catch (IOException ioe) { throw ioe; } return null; } /** * Retrieves leave types * *

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 activeOnly Filters leave types by active status. By default the API returns all leave * types. * @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 getLeaveTypesForHttpResponse( String accessToken, String xeroTenantId, Integer page, Boolean activeOnly) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException( "Missing the required parameter 'xeroTenantId' when calling getLeaveTypes"); } if (accessToken == null) { throw new IllegalArgumentException( "Missing the required parameter 'accessToken' when calling getLeaveTypes"); } HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/LeaveTypes"); 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); } } if (activeOnly != null) { String key = "ActiveOnly"; Object value = activeOnly; 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 pay run by using a unique pay run ID * *

200 - search results matching criteria * * @param xeroTenantId Xero identifier for Tenant * @param payRunID Identifier for the pay run * @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 getPayRun(String accessToken, String xeroTenantId, UUID payRunID) throws IOException { try { TypeReference typeRef = new TypeReference() {}; HttpResponse response = getPayRunForHttpResponse(accessToken, xeroTenantId, payRunID); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { if (logger.isDebugEnabled()) { logger.debug( "------------------ HttpResponseException " + e.getStatusCode() + " : getPayRun -------------------"); 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; } /** * Retrieves a specific pay run by using a unique pay run ID * *

200 - search results matching criteria * * @param xeroTenantId Xero identifier for Tenant * @param payRunID Identifier for the pay run * @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 getPayRunForHttpResponse( String accessToken, String xeroTenantId, UUID payRunID) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException( "Missing the required parameter 'xeroTenantId' when calling getPayRun"); } // verify the required parameter 'payRunID' is set if (payRunID == null) { throw new IllegalArgumentException( "Missing the required parameter 'payRunID' when calling getPayRun"); } if (accessToken == null) { throw new IllegalArgumentException( "Missing the required parameter 'accessToken' when calling getPayRun"); } 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("PayRunID", payRunID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PayRuns/{PayRunID}"); 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 a specific payrun calendar by using a unique payrun calendar ID * *

200 - search results matching criteria * * @param xeroTenantId Xero identifier for Tenant * @param payRunCalendarID Identifier for the payrun calendars * @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 getPayRunCalendar( String accessToken, String xeroTenantId, UUID payRunCalendarID) throws IOException { try { TypeReference typeRef = new TypeReference() {}; HttpResponse response = getPayRunCalendarForHttpResponse(accessToken, xeroTenantId, payRunCalendarID); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { if (logger.isDebugEnabled()) { logger.debug( "------------------ HttpResponseException " + e.getStatusCode() + " : getPayRunCalendar -------------------"); 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; } /** * Retrieves a specific payrun calendar by using a unique payrun calendar ID * *

200 - search results matching criteria * * @param xeroTenantId Xero identifier for Tenant * @param payRunCalendarID Identifier for the payrun calendars * @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 getPayRunCalendarForHttpResponse( String accessToken, String xeroTenantId, UUID payRunCalendarID) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException( "Missing the required parameter 'xeroTenantId' when calling getPayRunCalendar"); } // verify the required parameter 'payRunCalendarID' is set if (payRunCalendarID == null) { throw new IllegalArgumentException( "Missing the required parameter 'payRunCalendarID' when calling getPayRunCalendar"); } if (accessToken == null) { throw new IllegalArgumentException( "Missing the required parameter 'accessToken' when calling getPayRunCalendar"); } 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("PayRunCalendarID", payRunCalendarID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PayRunCalendars/{PayRunCalendarID}"); 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 payrun calendars * *

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 PayRunCalendars * @throws IOException if an error occurs while attempting to invoke the API * */ public PayRunCalendars getPayRunCalendars(String accessToken, String xeroTenantId, Integer page) throws IOException { try { TypeReference typeRef = new TypeReference() {}; HttpResponse response = getPayRunCalendarsForHttpResponse(accessToken, xeroTenantId, page); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { if (logger.isDebugEnabled()) { logger.debug( "------------------ HttpResponseException " + e.getStatusCode() + " : getPayRunCalendars -------------------"); logger.debug(e.toString()); } XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); if (e.getStatusCode() == 400 || e.getStatusCode() == 405) { TypeReference errorTypeRef = new TypeReference() {}; PayRunCalendars object = apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef); handler.validationError(e.getStatusCode(), "PayRunCalendars", object.getProblem(), e); } else { handler.execute(e); } } catch (IOException ioe) { throw ioe; } return null; } /** * Retrieves payrun calendars * *

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 getPayRunCalendarsForHttpResponse( 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 getPayRunCalendars"); } if (accessToken == null) { throw new IllegalArgumentException( "Missing the required parameter 'accessToken' when calling getPayRunCalendars"); } HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PayRunCalendars"); 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 pay runs * *

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 status By default get payruns will return all the payruns for an organization. You can * add GET https://api.xero.com/payroll.xro/2.0/payRuns?statu={PayRunStatus} to filter * the payruns by status. * @param accessToken Authorization token for user set in header of each request * @return PayRuns * @throws IOException if an error occurs while attempting to invoke the API * */ public PayRuns getPayRuns(String accessToken, String xeroTenantId, Integer page, String status) throws IOException { try { TypeReference typeRef = new TypeReference() {}; HttpResponse response = getPayRunsForHttpResponse(accessToken, xeroTenantId, page, status); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { if (logger.isDebugEnabled()) { logger.debug( "------------------ HttpResponseException " + e.getStatusCode() + " : getPayRuns -------------------"); logger.debug(e.toString()); } XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); if (e.getStatusCode() == 400 || e.getStatusCode() == 405) { TypeReference errorTypeRef = new TypeReference() {}; PayRuns object = apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef); handler.validationError(e.getStatusCode(), "PayRuns", object.getProblem(), e); } else { handler.execute(e); } } catch (IOException ioe) { throw ioe; } return null; } /** * Retrieves pay runs * *

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 status By default get payruns will return all the payruns for an organization. You can * add GET https://api.xero.com/payroll.xro/2.0/payRuns?statu={PayRunStatus} to filter * the payruns by status. * @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 getPayRunsForHttpResponse( String accessToken, String xeroTenantId, Integer page, String status) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException( "Missing the required parameter 'xeroTenantId' when calling getPayRuns"); } if (accessToken == null) { throw new IllegalArgumentException( "Missing the required parameter 'accessToken' when calling getPayRuns"); } HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PayRuns"); 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); } } if (status != null) { String key = "status"; Object value = status; 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 payslip by using a unique payslip ID * *

200 - search results matching criteria * * @param xeroTenantId Xero identifier for Tenant * @param payslipID Identifier for the payslip * @param accessToken Authorization token for user set in header of each request * @return PayslipObject * @throws IOException if an error occurs while attempting to invoke the API * */ public PayslipObject getPaySlip(String accessToken, String xeroTenantId, UUID payslipID) throws IOException { try { TypeReference typeRef = new TypeReference() {}; HttpResponse response = getPaySlipForHttpResponse(accessToken, xeroTenantId, payslipID); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { if (logger.isDebugEnabled()) { logger.debug( "------------------ HttpResponseException " + e.getStatusCode() + " : getPaySlip -------------------"); logger.debug(e.toString()); } XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); if (e.getStatusCode() == 400 || e.getStatusCode() == 405) { TypeReference errorTypeRef = new TypeReference() {}; PayslipObject object = apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef); handler.validationError(e.getStatusCode(), "PayslipObject", object.getProblem(), e); } else { handler.execute(e); } } catch (IOException ioe) { throw ioe; } return null; } /** * Retrieves a specific payslip by using a unique payslip ID * *

200 - search results matching criteria * * @param xeroTenantId Xero identifier for Tenant * @param payslipID Identifier for the payslip * @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 getPaySlipForHttpResponse( String accessToken, String xeroTenantId, UUID payslipID) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException( "Missing the required parameter 'xeroTenantId' when calling getPaySlip"); } // verify the required parameter 'payslipID' is set if (payslipID == null) { throw new IllegalArgumentException( "Missing the required parameter 'payslipID' when calling getPaySlip"); } if (accessToken == null) { throw new IllegalArgumentException( "Missing the required parameter 'accessToken' when calling getPaySlip"); } 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("PayslipID", payslipID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Payslips/{PayslipID}"); 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 payslips * *

200 - search results matching criteria * * @param xeroTenantId Xero identifier for Tenant * @param payRunID PayrunID which specifies the containing payrun of payslips to retrieve. By * default, the API does not group payslips by payrun. * @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 Payslips * @throws IOException if an error occurs while attempting to invoke the API * */ public Payslips getPaySlips(String accessToken, String xeroTenantId, UUID payRunID, Integer page) throws IOException { try { TypeReference typeRef = new TypeReference() {}; HttpResponse response = getPaySlipsForHttpResponse(accessToken, xeroTenantId, payRunID, page); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { if (logger.isDebugEnabled()) { logger.debug( "------------------ HttpResponseException " + e.getStatusCode() + " : getPaySlips -------------------"); logger.debug(e.toString()); } XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); if (e.getStatusCode() == 400 || e.getStatusCode() == 405) { TypeReference errorTypeRef = new TypeReference() {}; Payslips object = apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef); handler.validationError(e.getStatusCode(), "Payslips", object.getProblem(), e); } else { handler.execute(e); } } catch (IOException ioe) { throw ioe; } return null; } /** * Retrieves payslips * *

200 - search results matching criteria * * @param xeroTenantId Xero identifier for Tenant * @param payRunID PayrunID which specifies the containing payrun of payslips to retrieve. By * default, the API does not group payslips by payrun. * @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 getPaySlipsForHttpResponse( String accessToken, String xeroTenantId, UUID payRunID, Integer page) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException( "Missing the required parameter 'xeroTenantId' when calling getPaySlips"); } // verify the required parameter 'payRunID' is set if (payRunID == null) { throw new IllegalArgumentException( "Missing the required parameter 'payRunID' when calling getPaySlips"); } if (accessToken == null) { throw new IllegalArgumentException( "Missing the required parameter 'accessToken' when calling getPaySlips"); } HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Payslips"); 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); } } if (payRunID != null) { String key = "PayRunID"; Object value = payRunID; 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 reimbursement by using a unique reimbursement id * *

200 - search results matching criteria * * @param xeroTenantId Xero identifier for Tenant * @param reimbursementID Identifier for the reimbursement * @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 getReimbursement( String accessToken, String xeroTenantId, UUID reimbursementID) throws IOException { try { TypeReference typeRef = new TypeReference() {}; HttpResponse response = getReimbursementForHttpResponse(accessToken, xeroTenantId, reimbursementID); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { if (logger.isDebugEnabled()) { logger.debug( "------------------ HttpResponseException " + e.getStatusCode() + " : getReimbursement -------------------"); 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; } /** * Retrieves a specific reimbursement by using a unique reimbursement id * *

200 - search results matching criteria * * @param xeroTenantId Xero identifier for Tenant * @param reimbursementID Identifier for the reimbursement * @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 getReimbursementForHttpResponse( String accessToken, String xeroTenantId, UUID reimbursementID) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException( "Missing the required parameter 'xeroTenantId' when calling getReimbursement"); } // verify the required parameter 'reimbursementID' is set if (reimbursementID == null) { throw new IllegalArgumentException( "Missing the required parameter 'reimbursementID' when calling getReimbursement"); } if (accessToken == null) { throw new IllegalArgumentException( "Missing the required parameter 'accessToken' when calling getReimbursement"); } 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("ReimbursementID", reimbursementID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reimbursements/{ReimbursementID}"); 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 reimbursements * *

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 Reimbursements * @throws IOException if an error occurs while attempting to invoke the API * */ public Reimbursements getReimbursements(String accessToken, String xeroTenantId, Integer page) throws IOException { try { TypeReference typeRef = new TypeReference() {}; HttpResponse response = getReimbursementsForHttpResponse(accessToken, xeroTenantId, page); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { if (logger.isDebugEnabled()) { logger.debug( "------------------ HttpResponseException " + e.getStatusCode() + " : getReimbursements -------------------"); logger.debug(e.toString()); } XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); if (e.getStatusCode() == 400 || e.getStatusCode() == 405) { TypeReference errorTypeRef = new TypeReference() {}; Reimbursements object = apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef); handler.validationError(e.getStatusCode(), "Reimbursements", object.getProblem(), e); } else { handler.execute(e); } } catch (IOException ioe) { throw ioe; } return null; } /** * Retrieves reimbursements * *

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 getReimbursementsForHttpResponse( 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 getReimbursements"); } if (accessToken == null) { throw new IllegalArgumentException( "Missing the required parameter 'accessToken' when calling getReimbursements"); } HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Reimbursements"); 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 payroll settings * *

200 - search results matching criteria * * @param xeroTenantId Xero identifier for Tenant * @param accessToken Authorization token for user set in header of each request * @return Settings * @throws IOException if an error occurs while attempting to invoke the API * */ public Settings getSettings(String accessToken, String xeroTenantId) throws IOException { try { TypeReference typeRef = new TypeReference() {}; HttpResponse response = getSettingsForHttpResponse(accessToken, xeroTenantId); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { if (logger.isDebugEnabled()) { logger.debug( "------------------ HttpResponseException " + e.getStatusCode() + " : getSettings -------------------"); logger.debug(e.toString()); } XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); if (e.getStatusCode() == 400 || e.getStatusCode() == 405) { TypeReference errorTypeRef = new TypeReference() {}; Settings object = apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef); handler.validationError(e.getStatusCode(), "Settings", object.getProblem(), e); } else { handler.execute(e); } } catch (IOException ioe) { throw ioe; } return null; } /** * Retrieves payroll settings * *

200 - search results matching criteria * * @param xeroTenantId Xero identifier for Tenant * @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 getSettingsForHttpResponse(String accessToken, String xeroTenantId) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException( "Missing the required parameter 'xeroTenantId' when calling getSettings"); } if (accessToken == null) { throw new IllegalArgumentException( "Missing the required parameter 'accessToken' when calling getSettings"); } HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Settings"); 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 employee's summary of statutory leaves using a unique employee ID * *

200 - search results matching criteria * * @param xeroTenantId Xero identifier for Tenant * @param employeeID Employee id for single object * @param activeOnly Filter response with leaves that are currently active or yet to be taken. If * not specified, all leaves (past, current, and future scheduled) are returned * @param accessToken Authorization token for user set in header of each request * @return EmployeeStatutoryLeavesSummaries * @throws IOException if an error occurs while attempting to invoke the API * */ public EmployeeStatutoryLeavesSummaries getStatutoryLeaveSummary( String accessToken, String xeroTenantId, UUID employeeID, Boolean activeOnly) throws IOException { try { TypeReference typeRef = new TypeReference() {}; HttpResponse response = getStatutoryLeaveSummaryForHttpResponse( accessToken, xeroTenantId, employeeID, activeOnly); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { if (logger.isDebugEnabled()) { logger.debug( "------------------ HttpResponseException " + e.getStatusCode() + " : getStatutoryLeaveSummary -------------------"); logger.debug(e.toString()); } XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); if (e.getStatusCode() == 400 || e.getStatusCode() == 405) { TypeReference errorTypeRef = new TypeReference() {}; EmployeeStatutoryLeavesSummaries object = apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef); handler.validationError( e.getStatusCode(), "EmployeeStatutoryLeavesSummaries", object.getProblem(), e); } else { handler.execute(e); } } catch (IOException ioe) { throw ioe; } return null; } /** * Retrieves a specific employee's summary of statutory leaves using a unique employee ID * *

200 - search results matching criteria * * @param xeroTenantId Xero identifier for Tenant * @param employeeID Employee id for single object * @param activeOnly Filter response with leaves that are currently active or yet to be taken. If * not specified, all leaves (past, current, and future scheduled) are returned * @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 getStatutoryLeaveSummaryForHttpResponse( String accessToken, String xeroTenantId, UUID employeeID, Boolean activeOnly) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException( "Missing the required parameter 'xeroTenantId' when calling getStatutoryLeaveSummary"); } // verify the required parameter 'employeeID' is set if (employeeID == null) { throw new IllegalArgumentException( "Missing the required parameter 'employeeID' when calling getStatutoryLeaveSummary"); } if (accessToken == null) { throw new IllegalArgumentException( "Missing the required parameter 'accessToken' when calling getStatutoryLeaveSummary"); } 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() + "/StatutoryLeaves/Summary/{EmployeeID}"); if (activeOnly != null) { String key = "activeOnly"; Object value = activeOnly; 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(); } /** * Retrieve a specific timesheet by using a unique timesheet ID * *

200 - search results matching criteria * * @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 TimesheetObject * @throws IOException if an error occurs while attempting to invoke the API * */ public TimesheetObject getTimesheet(String accessToken, String xeroTenantId, UUID timesheetID) throws IOException { try { TypeReference typeRef = new TypeReference() {}; HttpResponse response = getTimesheetForHttpResponse(accessToken, xeroTenantId, timesheetID); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { if (logger.isDebugEnabled()) { logger.debug( "------------------ HttpResponseException " + e.getStatusCode() + " : getTimesheet -------------------"); 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; } /** * Retrieve a specific timesheet by using a unique timesheet ID * *

200 - search results matching criteria * * @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 getTimesheetForHttpResponse( 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 getTimesheet"); } // verify the required parameter 'timesheetID' is set if (timesheetID == null) { throw new IllegalArgumentException( "Missing the required parameter 'timesheetID' when calling getTimesheet"); } if (accessToken == null) { throw new IllegalArgumentException( "Missing the required parameter 'accessToken' when calling getTimesheet"); } 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("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 timesheets * *

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 filter Filter by employeeId and/or payrollCalendarId * @param status filter results by any timesheets with a matching timesheet status * @param startDate filter results by any timesheets with a startDate on or after the provided * date * @param endDate filter results by any timesheets with a endDate on or before the provided date * @param sort sort the order of timesheets returned. The default is based on the timesheets * createdDate, sorted oldest to newest. Currently, the only other option is to reverse the * order based on the timesheets startDate, sorted newest to oldest. * @param accessToken Authorization token for user set in header of each request * @return Timesheets * @throws IOException if an error occurs while attempting to invoke the API * */ public Timesheets getTimesheets( String accessToken, String xeroTenantId, Integer page, String filter, String status, String startDate, String endDate, String sort) throws IOException { try { TypeReference typeRef = new TypeReference() {}; HttpResponse response = getTimesheetsForHttpResponse( accessToken, xeroTenantId, page, filter, status, startDate, endDate, sort); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { if (logger.isDebugEnabled()) { logger.debug( "------------------ HttpResponseException " + e.getStatusCode() + " : getTimesheets -------------------"); logger.debug(e.toString()); } XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); if (e.getStatusCode() == 400 || e.getStatusCode() == 405) { TypeReference errorTypeRef = new TypeReference() {}; Timesheets object = apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef); handler.validationError(e.getStatusCode(), "Timesheets", object.getProblem(), e); } else { handler.execute(e); } } catch (IOException ioe) { throw ioe; } return null; } /** * Retrieves timesheets * *

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 filter Filter by employeeId and/or payrollCalendarId * @param status filter results by any timesheets with a matching timesheet status * @param startDate filter results by any timesheets with a startDate on or after the provided * date * @param endDate filter results by any timesheets with a endDate on or before the provided date * @param sort sort the order of timesheets returned. The default is based on the timesheets * createdDate, sorted oldest to newest. Currently, the only other option is to reverse the * order based on the timesheets startDate, sorted newest to oldest. * @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 getTimesheetsForHttpResponse( String accessToken, String xeroTenantId, Integer page, String filter, String status, String startDate, String endDate, String sort) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException( "Missing the required parameter 'xeroTenantId' when calling getTimesheets"); } if (accessToken == null) { throw new IllegalArgumentException( "Missing the required parameter 'accessToken' when calling getTimesheets"); } HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Timesheets"); 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); } } if (filter != null) { String key = "filter"; Object value = filter; 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 (status != null) { String key = "status"; Object value = status; 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 (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); } } if (sort != null) { String key = "sort"; Object value = sort; 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 tracking categories * *

200 - search results matching criteria * * @param xeroTenantId Xero identifier for Tenant * @param accessToken Authorization token for user set in header of each request * @return TrackingCategories * @throws IOException if an error occurs while attempting to invoke the API * */ public TrackingCategories getTrackingCategories(String accessToken, String xeroTenantId) throws IOException { try { TypeReference typeRef = new TypeReference() {}; HttpResponse response = getTrackingCategoriesForHttpResponse(accessToken, xeroTenantId); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { if (logger.isDebugEnabled()) { logger.debug( "------------------ HttpResponseException " + e.getStatusCode() + " : getTrackingCategories -------------------"); logger.debug(e.toString()); } XeroApiExceptionHandler handler = new XeroApiExceptionHandler(); if (e.getStatusCode() == 400 || e.getStatusCode() == 405) { TypeReference errorTypeRef = new TypeReference() {}; TrackingCategories object = apiClient.getObjectMapper().readValue(e.getContent(), errorTypeRef); handler.validationError(e.getStatusCode(), "TrackingCategories", object.getProblem(), e); } else { handler.execute(e); } } catch (IOException ioe) { throw ioe; } return null; } /** * Retrieves tracking categories * *

200 - search results matching criteria * * @param xeroTenantId Xero identifier for Tenant * @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 getTrackingCategoriesForHttpResponse(String accessToken, String xeroTenantId) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException( "Missing the required parameter 'xeroTenantId' when calling getTrackingCategories"); } if (accessToken == null) { throw new IllegalArgumentException( "Missing the required parameter 'accessToken' when calling getTrackingCategories"); } HttpHeaders headers = new HttpHeaders(); headers.set("Xero-Tenant-Id", xeroTenantId); headers.setAccept("application/json"); headers.setUserAgent(this.getUserAgent()); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/Settings/trackingCategories"); 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(); } /** * Reverts a specific timesheet to draft * *

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 revertTimesheet( String accessToken, String xeroTenantId, UUID timesheetID, String idempotencyKey) throws IOException { try { TypeReference typeRef = new TypeReference() {}; HttpResponse response = revertTimesheetForHttpResponse(accessToken, xeroTenantId, timesheetID, idempotencyKey); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { if (logger.isDebugEnabled()) { logger.debug( "------------------ HttpResponseException " + e.getStatusCode() + " : revertTimesheet -------------------"); 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; } /** * Reverts a specific timesheet to draft * *

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 revertTimesheetForHttpResponse( 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 revertTimesheet"); } // verify the required parameter 'timesheetID' is set if (timesheetID == null) { throw new IllegalArgumentException( "Missing the required parameter 'timesheetID' when calling revertTimesheet"); } if (accessToken == null) { throw new IllegalArgumentException( "Missing the required parameter 'accessToken' when calling revertTimesheet"); } 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}/RevertToDraft"); 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(); } /** * Updates a specific employee's detail * *

200 - successful response * *

400 - validation error for a bad request * * @param xeroTenantId Xero identifier for Tenant * @param employeeID Employee id for single object * @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 updateEmployee( String accessToken, String xeroTenantId, UUID employeeID, Employee employee, String idempotencyKey) throws IOException { try { TypeReference typeRef = new TypeReference() {}; HttpResponse response = updateEmployeeForHttpResponse( accessToken, xeroTenantId, employeeID, employee, idempotencyKey); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { if (logger.isDebugEnabled()) { logger.debug( "------------------ HttpResponseException " + e.getStatusCode() + " : updateEmployee -------------------"); 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; } /** * Updates a specific employee's detail * *

200 - successful response * *

400 - validation error for a bad request * * @param xeroTenantId Xero identifier for Tenant * @param employeeID Employee id for single object * @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 updateEmployeeForHttpResponse( String accessToken, String xeroTenantId, UUID employeeID, 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 updateEmployee"); } // verify the required parameter 'employeeID' is set if (employeeID == null) { throw new IllegalArgumentException( "Missing the required parameter 'employeeID' when calling updateEmployee"); } // verify the required parameter 'employee' is set if (employee == null) { throw new IllegalArgumentException( "Missing the required parameter 'employee' when calling updateEmployee"); } if (accessToken == null) { throw new IllegalArgumentException( "Missing the required parameter 'accessToken' when calling updateEmployee"); } 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}"); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); if (logger.isDebugEnabled()) { logger.debug("PUT " + 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.PUT, genericUrl, content) .setHeaders(headers) .setConnectTimeout(apiClient.getConnectionTimeout()) .setReadTimeout(apiClient.getReadTimeout()) .execute(); } /** * Updates a specific employee's earnings template records * *

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 payTemplateEarningID Id for single pay template earnings 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 updateEmployeeEarningsTemplate( String accessToken, String xeroTenantId, UUID employeeID, UUID payTemplateEarningID, EarningsTemplate earningsTemplate, String idempotencyKey) throws IOException { try { TypeReference typeRef = new TypeReference() {}; HttpResponse response = updateEmployeeEarningsTemplateForHttpResponse( accessToken, xeroTenantId, employeeID, payTemplateEarningID, earningsTemplate, idempotencyKey); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { if (logger.isDebugEnabled()) { logger.debug( "------------------ HttpResponseException " + e.getStatusCode() + " : updateEmployeeEarningsTemplate -------------------"); 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; } /** * Updates a specific employee's earnings template records * *

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 payTemplateEarningID Id for single pay template earnings 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 updateEmployeeEarningsTemplateForHttpResponse( String accessToken, String xeroTenantId, UUID employeeID, UUID payTemplateEarningID, 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" + " updateEmployeeEarningsTemplate"); } // verify the required parameter 'employeeID' is set if (employeeID == null) { throw new IllegalArgumentException( "Missing the required parameter 'employeeID' when calling" + " updateEmployeeEarningsTemplate"); } // verify the required parameter 'payTemplateEarningID' is set if (payTemplateEarningID == null) { throw new IllegalArgumentException( "Missing the required parameter 'payTemplateEarningID' when calling" + " updateEmployeeEarningsTemplate"); } // verify the required parameter 'earningsTemplate' is set if (earningsTemplate == null) { throw new IllegalArgumentException( "Missing the required parameter 'earningsTemplate' when calling" + " updateEmployeeEarningsTemplate"); } if (accessToken == null) { throw new IllegalArgumentException( "Missing the required parameter 'accessToken' when calling" + " updateEmployeeEarningsTemplate"); } 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); 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("PUT " + 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.PUT, genericUrl, content) .setHeaders(headers) .setConnectTimeout(apiClient.getConnectionTimeout()) .setReadTimeout(apiClient.getReadTimeout()) .execute(); } /** * Updates a specific employee's leave records * *

200 - successful response * *

400 - validation error for a bad request * * @param xeroTenantId Xero identifier for Tenant * @param employeeID Employee id for single object * @param leaveID Leave 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 updateEmployeeLeave( String accessToken, String xeroTenantId, UUID employeeID, UUID leaveID, EmployeeLeave employeeLeave, String idempotencyKey) throws IOException { try { TypeReference typeRef = new TypeReference() {}; HttpResponse response = updateEmployeeLeaveForHttpResponse( accessToken, xeroTenantId, employeeID, leaveID, employeeLeave, idempotencyKey); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { if (logger.isDebugEnabled()) { logger.debug( "------------------ HttpResponseException " + e.getStatusCode() + " : updateEmployeeLeave -------------------"); 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; } /** * Updates a specific employee's leave records * *

200 - successful response * *

400 - validation error for a bad request * * @param xeroTenantId Xero identifier for Tenant * @param employeeID Employee id for single object * @param leaveID Leave 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 updateEmployeeLeaveForHttpResponse( String accessToken, String xeroTenantId, UUID employeeID, UUID leaveID, 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 updateEmployeeLeave"); } // verify the required parameter 'employeeID' is set if (employeeID == null) { throw new IllegalArgumentException( "Missing the required parameter 'employeeID' when calling updateEmployeeLeave"); } // verify the required parameter 'leaveID' is set if (leaveID == null) { throw new IllegalArgumentException( "Missing the required parameter 'leaveID' when calling updateEmployeeLeave"); } // verify the required parameter 'employeeLeave' is set if (employeeLeave == null) { throw new IllegalArgumentException( "Missing the required parameter 'employeeLeave' when calling updateEmployeeLeave"); } if (accessToken == null) { throw new IllegalArgumentException( "Missing the required parameter 'accessToken' when calling updateEmployeeLeave"); } 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); 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("PUT " + 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.PUT, genericUrl, content) .setHeaders(headers) .setConnectTimeout(apiClient.getConnectionTimeout()) .setReadTimeout(apiClient.getReadTimeout()) .execute(); } /** * Updates a specific employee's opening balances * *

200 - successful response * *

400 - validation error for a bad request * * @param xeroTenantId Xero identifier for Tenant * @param employeeID Employee id for single object * @param employeeOpeningBalances The employeeOpeningBalances 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 updateEmployeeOpeningBalances( String accessToken, String xeroTenantId, UUID employeeID, EmployeeOpeningBalances employeeOpeningBalances, String idempotencyKey) throws IOException { try { TypeReference typeRef = new TypeReference() {}; HttpResponse response = updateEmployeeOpeningBalancesForHttpResponse( accessToken, xeroTenantId, employeeID, employeeOpeningBalances, idempotencyKey); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { if (logger.isDebugEnabled()) { logger.debug( "------------------ HttpResponseException " + e.getStatusCode() + " : updateEmployeeOpeningBalances -------------------"); 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; } /** * Updates a specific employee's opening balances * *

200 - successful response * *

400 - validation error for a bad request * * @param xeroTenantId Xero identifier for Tenant * @param employeeID Employee id for single object * @param employeeOpeningBalances The employeeOpeningBalances 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 updateEmployeeOpeningBalancesForHttpResponse( String accessToken, String xeroTenantId, UUID employeeID, EmployeeOpeningBalances employeeOpeningBalances, String idempotencyKey) throws IOException { // verify the required parameter 'xeroTenantId' is set if (xeroTenantId == null) { throw new IllegalArgumentException( "Missing the required parameter 'xeroTenantId' when calling" + " updateEmployeeOpeningBalances"); } // verify the required parameter 'employeeID' is set if (employeeID == null) { throw new IllegalArgumentException( "Missing the required parameter 'employeeID' when calling updateEmployeeOpeningBalances"); } // verify the required parameter 'employeeOpeningBalances' is set if (employeeOpeningBalances == null) { throw new IllegalArgumentException( "Missing the required parameter 'employeeOpeningBalances' when calling" + " updateEmployeeOpeningBalances"); } if (accessToken == null) { throw new IllegalArgumentException( "Missing the required parameter 'accessToken' when calling" + " updateEmployeeOpeningBalances"); } 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}/ukopeningbalances"); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); if (logger.isDebugEnabled()) { logger.debug("PUT " + genericUrl.toString()); } HttpContent content = null; content = apiClient.new JacksonJsonHttpContent(employeeOpeningBalances); Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken); HttpTransport transport = apiClient.getHttpTransport(); HttpRequestFactory requestFactory = transport.createRequestFactory(credential); return requestFactory .buildRequest(HttpMethods.PUT, genericUrl, content) .setHeaders(headers) .setConnectTimeout(apiClient.getConnectionTimeout()) .setReadTimeout(apiClient.getReadTimeout()) .execute(); } /** * Updates salary and wages record 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 salaryAndWagesID Id for single pay template earnings 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 updateEmployeeSalaryAndWage( String accessToken, String xeroTenantId, UUID employeeID, UUID salaryAndWagesID, SalaryAndWage salaryAndWage, String idempotencyKey) throws IOException { try { TypeReference typeRef = new TypeReference() {}; HttpResponse response = updateEmployeeSalaryAndWageForHttpResponse( accessToken, xeroTenantId, employeeID, salaryAndWagesID, salaryAndWage, idempotencyKey); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { if (logger.isDebugEnabled()) { logger.debug( "------------------ HttpResponseException " + e.getStatusCode() + " : updateEmployeeSalaryAndWage -------------------"); 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; } /** * Updates salary and wages record 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 salaryAndWagesID Id for single pay template earnings 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 updateEmployeeSalaryAndWageForHttpResponse( String accessToken, String xeroTenantId, UUID employeeID, UUID salaryAndWagesID, 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 updateEmployeeSalaryAndWage"); } // verify the required parameter 'employeeID' is set if (employeeID == null) { throw new IllegalArgumentException( "Missing the required parameter 'employeeID' when calling updateEmployeeSalaryAndWage"); } // verify the required parameter 'salaryAndWagesID' is set if (salaryAndWagesID == null) { throw new IllegalArgumentException( "Missing the required parameter 'salaryAndWagesID' when calling" + " updateEmployeeSalaryAndWage"); } // verify the required parameter 'salaryAndWage' is set if (salaryAndWage == null) { throw new IllegalArgumentException( "Missing the required parameter 'salaryAndWage' when calling" + " updateEmployeeSalaryAndWage"); } if (accessToken == null) { throw new IllegalArgumentException( "Missing the required parameter 'accessToken' when calling updateEmployeeSalaryAndWage"); } 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); 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("PUT " + 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.PUT, genericUrl, content) .setHeaders(headers) .setConnectTimeout(apiClient.getConnectionTimeout()) .setReadTimeout(apiClient.getReadTimeout()) .execute(); } /** * Updates a specific pay run * *

200 - search results matching criteria * *

400 - validation error for a bad request * * @param xeroTenantId Xero identifier for Tenant * @param payRunID Identifier for the pay run * @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 updatePayRun( String accessToken, String xeroTenantId, UUID payRunID, PayRun payRun, String idempotencyKey) throws IOException { try { TypeReference typeRef = new TypeReference() {}; HttpResponse response = updatePayRunForHttpResponse(accessToken, xeroTenantId, payRunID, payRun, idempotencyKey); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { if (logger.isDebugEnabled()) { logger.debug( "------------------ HttpResponseException " + e.getStatusCode() + " : updatePayRun -------------------"); 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; } /** * Updates a specific pay run * *

200 - search results matching criteria * *

400 - validation error for a bad request * * @param xeroTenantId Xero identifier for Tenant * @param payRunID Identifier for the pay run * @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 updatePayRunForHttpResponse( String accessToken, String xeroTenantId, UUID payRunID, 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 updatePayRun"); } // verify the required parameter 'payRunID' is set if (payRunID == null) { throw new IllegalArgumentException( "Missing the required parameter 'payRunID' when calling updatePayRun"); } // verify the required parameter 'payRun' is set if (payRun == null) { throw new IllegalArgumentException( "Missing the required parameter 'payRun' when calling updatePayRun"); } if (accessToken == null) { throw new IllegalArgumentException( "Missing the required parameter 'accessToken' when calling updatePayRun"); } 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("PayRunID", payRunID); UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + "/PayRuns/{PayRunID}"); String url = uriBuilder.buildFromMap(uriVariables).toString(); GenericUrl genericUrl = new GenericUrl(url); if (logger.isDebugEnabled()) { logger.debug("PUT " + 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.PUT, genericUrl, content) .setHeaders(headers) .setConnectTimeout(apiClient.getConnectionTimeout()) .setReadTimeout(apiClient.getReadTimeout()) .execute(); } /** * Updates a specific 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 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 updateTimesheetLine( String accessToken, String xeroTenantId, UUID timesheetID, UUID timesheetLineID, TimesheetLine timesheetLine, String idempotencyKey) throws IOException { try { TypeReference typeRef = new TypeReference() {}; HttpResponse response = updateTimesheetLineForHttpResponse( accessToken, xeroTenantId, timesheetID, timesheetLineID, timesheetLine, idempotencyKey); return apiClient.getObjectMapper().readValue(response.getContent(), typeRef); } catch (HttpResponseException e) { if (logger.isDebugEnabled()) { logger.debug( "------------------ HttpResponseException " + e.getStatusCode() + " : updateTimesheetLine -------------------"); 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; } /** * Updates a specific 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 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 updateTimesheetLineForHttpResponse( String accessToken, String xeroTenantId, UUID timesheetID, UUID timesheetLineID, 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 updateTimesheetLine"); } // verify the required parameter 'timesheetID' is set if (timesheetID == null) { throw new IllegalArgumentException( "Missing the required parameter 'timesheetID' when calling updateTimesheetLine"); } // verify the required parameter 'timesheetLineID' is set if (timesheetLineID == null) { throw new IllegalArgumentException( "Missing the required parameter 'timesheetLineID' when calling updateTimesheetLine"); } // verify the required parameter 'timesheetLine' is set if (timesheetLine == null) { throw new IllegalArgumentException( "Missing the required parameter 'timesheetLine' when calling updateTimesheetLine"); } if (accessToken == null) { throw new IllegalArgumentException( "Missing the required parameter 'accessToken' when calling updateTimesheetLine"); } 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); 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("PUT " + 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.PUT, genericUrl, content) .setHeaders(headers) .setConnectTimeout(apiClient.getConnectionTimeout()) .setReadTimeout(apiClient.getReadTimeout()) .execute(); } /** * convert intput to byte array * * @param is InputStream the server status code returned * @return byteArrayInputStream a ByteArrayInputStream * @throws IOException for failed or interrupted I/O operations */ public ByteArrayInputStream convertInputToByteArray(InputStream is) throws IOException { byte[] bytes = IOUtils.toByteArray(is); try { // Process the input stream.. ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes); return byteArrayInputStream; } finally { is.close(); } } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy