2626import com.xero.models.accounting.HistoryRecords;
2727import com.xero.models.accounting.InvoiceReminders;
2828import com.xero.models.accounting.Invoices;
29- import com.xero.models.accounting.Item;
3029import com.xero.models.accounting.Items;
3130import com.xero.models.accounting.Journals;
3231import com.xero.models.accounting.LinkedTransaction;
@@ -94,7 +93,7 @@ public class AccountingApi {
9493 private ApiClient apiClient;
9594 private static AccountingApi instance = null;
9695 private String userAgent = "Default";
97- private String version = "3.2.1 ";
96+ private String version = "3.2.2 ";
9897
9998 public AccountingApi() {
10099 this(new ApiClient());
@@ -1951,63 +1950,6 @@ public HttpResponse createInvoicesForHttpResponse(String accessToken, String xe
19511950 .setReadTimeout(apiClient.getReadTimeout()).execute();
19521951 }
19531952
1954- /**
1955- * Allows you to create a single item
1956- * <p><b>200</b> - Success - return response of type Items array with newly created Item
1957- * <p><b>400</b> - A failed request due to validation error
1958- * @param xeroTenantId Xero identifier for Tenant
1959- * @param item The item parameter
1960- * @param accessToken Authorization token for user set in header of each request
1961- * @return Items
1962- * @throws IOException if an error occurs while attempting to invoke the API
1963- **/
1964- public Items createItem(String accessToken, String xeroTenantId, Item item) throws IOException {
1965- try {
1966- TypeReference<Items> typeRef = new TypeReference<Items>() {};
1967- HttpResponse response = createItemForHttpResponse(accessToken, xeroTenantId, item);
1968- return apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
1969- } catch (HttpResponseException e) {
1970- XeroApiExceptionHandler handler = new XeroApiExceptionHandler();
1971- handler.execute(e,apiClient);
1972- } catch (IOException ioe) {
1973- throw ioe;
1974- }
1975- return null;
1976- }
1977-
1978- public HttpResponse createItemForHttpResponse(String accessToken, String xeroTenantId, Item item) throws IOException {
1979- // verify the required parameter 'xeroTenantId' is set
1980- if (xeroTenantId == null) {
1981- throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling createItem");
1982- }// verify the required parameter 'item' is set
1983- if (item == null) {
1984- throw new IllegalArgumentException("Missing the required parameter 'item' when calling createItem");
1985- }
1986- if (accessToken == null) {
1987- throw new IllegalArgumentException("Missing the required parameter 'accessToken' when calling createItem");
1988- }
1989- HttpHeaders headers = new HttpHeaders();
1990- headers.set("xero-tenant-id", xeroTenantId);
1991- headers.setAccept("application/json");
1992- headers.setUserAgent(this.getUserAgent());
1993-
1994- String correctPath = "/Items";
1995- UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath);
1996- String url = uriBuilder.build().toString();
1997- GenericUrl genericUrl = new GenericUrl(url);
1998-
1999-
2000- HttpContent content = null;
2001- content = apiClient.new JacksonJsonHttpContent(item);
2002-
2003- Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken);
2004- HttpTransport transport = apiClient.getHttpTransport();
2005- HttpRequestFactory requestFactory = transport.createRequestFactory(credential);
2006- return requestFactory.buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers)
2007- .setConnectTimeout(apiClient.getConnectionTimeout())
2008- .setReadTimeout(apiClient.getReadTimeout()).execute();
2009- }
2010-
20111953 /**
20121954 * Allows you to create a history record for items
20131955 * <p><b>200</b> - Unsupported - return response incorrect exception, API is not able to create HistoryRecord for Items
@@ -11214,17 +11156,16 @@ public HttpResponse getReportBalanceSheetForHttpResponse(String accessToken, St
1121411156 * Allows you to retrieve report for BankSummary
1121511157 * <p><b>200</b> - Success - return response of type ReportWithRows
1121611158 * @param xeroTenantId Xero identifier for Tenant
11217- * @param date The date for the Bank Summary report e.g. 2018-03-31
11218- * @param period The number of periods to compare (integer between 1 and 12)
11219- * @param timeframe The period size to compare to (1=month, 3=quarter, 12=year)
11159+ * @param fromDate The from date for the Bank Summary report e.g. 2018-03-31
11160+ * @param toDate The to date for the Bank Summary report e.g. 2018-03-31
1122011161 * @param accessToken Authorization token for user set in header of each request
1122111162 * @return ReportWithRows
1122211163 * @throws IOException if an error occurs while attempting to invoke the API
1122311164 **/
11224- public ReportWithRows getReportBankSummary(String accessToken, String xeroTenantId, LocalDate date, Integer period, Integer timeframe ) throws IOException {
11165+ public ReportWithRows getReportBankSummary(String accessToken, String xeroTenantId, LocalDate fromDate, LocalDate toDate ) throws IOException {
1122511166 try {
1122611167 TypeReference<ReportWithRows> typeRef = new TypeReference<ReportWithRows>() {};
11227- HttpResponse response = getReportBankSummaryForHttpResponse(accessToken, xeroTenantId, date, period, timeframe );
11168+ HttpResponse response = getReportBankSummaryForHttpResponse(accessToken, xeroTenantId, fromDate, toDate );
1122811169 return apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
1122911170 } catch (HttpResponseException e) {
1123011171 XeroApiExceptionHandler handler = new XeroApiExceptionHandler();
@@ -11235,7 +11176,7 @@ public ReportWithRows getReportBankSummary(String accessToken, String xeroTenan
1123511176 return null;
1123611177 }
1123711178
11238- public HttpResponse getReportBankSummaryForHttpResponse(String accessToken, String xeroTenantId, LocalDate date , Integer period, Integer timeframe ) throws IOException {
11179+ public HttpResponse getReportBankSummaryForHttpResponse(String accessToken, String xeroTenantId, LocalDate fromDate , LocalDate toDate ) throws IOException {
1123911180 // verify the required parameter 'xeroTenantId' is set
1124011181 if (xeroTenantId == null) {
1124111182 throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling getReportBankSummary");
@@ -11250,29 +11191,19 @@ public HttpResponse getReportBankSummaryForHttpResponse(String accessToken, Str
1125011191
1125111192 String correctPath = "/Reports/BankSummary";
1125211193 UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath);
11253- if (date != null) {
11254- String key = "date";
11255- Object value = date;
11256- if (value instanceof Collection) {
11257- uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray());
11258- } else if (value instanceof Object[]) {
11259- uriBuilder = uriBuilder.queryParam(key, (Object[]) value);
11260- } else {
11261- uriBuilder = uriBuilder.queryParam(key, value);
11262- }
11263- } if (period != null) {
11264- String key = "period";
11265- Object value = period;
11194+ if (fromDate != null) {
11195+ String key = "fromDate";
11196+ Object value = fromDate;
1126611197 if (value instanceof Collection) {
1126711198 uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray());
1126811199 } else if (value instanceof Object[]) {
1126911200 uriBuilder = uriBuilder.queryParam(key, (Object[]) value);
1127011201 } else {
1127111202 uriBuilder = uriBuilder.queryParam(key, value);
1127211203 }
11273- } if (timeframe != null) {
11274- String key = "timeframe ";
11275- Object value = timeframe ;
11204+ } if (toDate != null) {
11205+ String key = "toDate ";
11206+ Object value = toDate ;
1127611207 if (value instanceof Collection) {
1127711208 uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray());
1127811209 } else if (value instanceof Object[]) {
@@ -13595,6 +13526,75 @@ public HttpResponse updateOrCreateInvoicesForHttpResponse(String accessToken, S
1359513526 .setReadTimeout(apiClient.getReadTimeout()).execute();
1359613527 }
1359713528
13529+ /**
13530+ * Allows you to update or create one or more items
13531+ * <p><b>200</b> - Success - return response of type Items array with newly created Item
13532+ * <p><b>400</b> - A failed request due to validation error
13533+ * @param xeroTenantId Xero identifier for Tenant
13534+ * @param items The items parameter
13535+ * @param summarizeErrors response format that shows validation errors for each bank transaction
13536+ * @param accessToken Authorization token for user set in header of each request
13537+ * @return Items
13538+ * @throws IOException if an error occurs while attempting to invoke the API
13539+ **/
13540+ public Items updateOrCreateItems(String accessToken, String xeroTenantId, Items items, Boolean summarizeErrors) throws IOException {
13541+ try {
13542+ TypeReference<Items> typeRef = new TypeReference<Items>() {};
13543+ HttpResponse response = updateOrCreateItemsForHttpResponse(accessToken, xeroTenantId, items, summarizeErrors);
13544+ return apiClient.getObjectMapper().readValue(response.getContent(), typeRef);
13545+ } catch (HttpResponseException e) {
13546+ XeroApiExceptionHandler handler = new XeroApiExceptionHandler();
13547+ handler.execute(e,apiClient);
13548+ } catch (IOException ioe) {
13549+ throw ioe;
13550+ }
13551+ return null;
13552+ }
13553+
13554+ public HttpResponse updateOrCreateItemsForHttpResponse(String accessToken, String xeroTenantId, Items items, Boolean summarizeErrors) throws IOException {
13555+ // verify the required parameter 'xeroTenantId' is set
13556+ if (xeroTenantId == null) {
13557+ throw new IllegalArgumentException("Missing the required parameter 'xeroTenantId' when calling updateOrCreateItems");
13558+ }// verify the required parameter 'items' is set
13559+ if (items == null) {
13560+ throw new IllegalArgumentException("Missing the required parameter 'items' when calling updateOrCreateItems");
13561+ }
13562+ if (accessToken == null) {
13563+ throw new IllegalArgumentException("Missing the required parameter 'accessToken' when calling updateOrCreateItems");
13564+ }
13565+ HttpHeaders headers = new HttpHeaders();
13566+ headers.set("xero-tenant-id", xeroTenantId);
13567+ headers.setAccept("application/json");
13568+ headers.setUserAgent(this.getUserAgent());
13569+
13570+ String correctPath = "/Items";
13571+ UriBuilder uriBuilder = UriBuilder.fromUri(apiClient.getBasePath() + correctPath);
13572+ if (summarizeErrors != null) {
13573+ String key = "summarizeErrors";
13574+ Object value = summarizeErrors;
13575+ if (value instanceof Collection) {
13576+ uriBuilder = uriBuilder.queryParam(key, ((Collection) value).toArray());
13577+ } else if (value instanceof Object[]) {
13578+ uriBuilder = uriBuilder.queryParam(key, (Object[]) value);
13579+ } else {
13580+ uriBuilder = uriBuilder.queryParam(key, value);
13581+ }
13582+ }
13583+ String url = uriBuilder.build().toString();
13584+ GenericUrl genericUrl = new GenericUrl(url);
13585+
13586+
13587+ HttpContent content = null;
13588+ content = apiClient.new JacksonJsonHttpContent(items);
13589+
13590+ Credential credential = new Credential(BearerToken.authorizationHeaderAccessMethod()).setAccessToken(accessToken);
13591+ HttpTransport transport = apiClient.getHttpTransport();
13592+ HttpRequestFactory requestFactory = transport.createRequestFactory(credential);
13593+ return requestFactory.buildRequest(HttpMethods.POST, genericUrl, content).setHeaders(headers)
13594+ .setConnectTimeout(apiClient.getConnectionTimeout())
13595+ .setReadTimeout(apiClient.getReadTimeout()).execute();
13596+ }
13597+
1359813598 /**
1359913599 * Allows you to update or create one or more purchase orders
1360013600 * <p><b>200</b> - Success - return response of type PurchaseOrder array for specified PurchaseOrder
0 commit comments